cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
Posted: Wed Dec 18, 2002 1:56 am Post subject: VDS 2 Font Dialog |
|
|
WARN VDS 2.x Example.
Found an oldie but goodie
Must be compiled before running.
Code: |
if @null(%1)
inifile open,@windir()\fontdlg.ini
goto main
else
end
inifile open,%1
goto main
:main
if @equal(%2,sample)
goto sample
else
end
title Fonts
DIALOG CREATE,Font,-1,0,400,158,-
DLGTYPE(NOMIN;smallcap;ONTOP),-
EDIT(EDIT1;25;10;145),-
LIST(LIST1;45;10;145;100;CLICK;sorted),-
TEXT(TEXT1;10;10;;;Font),-
TEXT(TEXT2;10;165;;;Font Style),-
EDIT(EDIT2;25;165;90),-
LIST(LIST2;45;165;90;100;CLICK),-
TEXT(TEXT3;10;265;;;Size),-
EDIT(EDIT3;25;265;40;;;EXIT),-
LIST(LIST3;45;265;40;100;click),-
BUTTON(BUTTON1;70;315;;25;OK),-
BUTTON(BUTTON2;100;315;;25;Cancel),-
RADIO(RADIO1;10;308;;44;Color),-
COMBO(COMBO1;26;312;72;32;;LIST;click)
window hide,fonts
list 2,create
list 1,create
LIST 1,REGVALS,LOCAL,Software\Microsoft\Windows\CurrentVersion\Fonts
%a = 0
%b = @count(1)
:loadloop
list 1,seek,%a
option fieldsep,(
parse "%c;%d",@item(1)
list 2,add,%c
%a = @succ(%a)
if @equal(%a,%b)
goto nextload
else
end
goto loadloop
list 2,seek,0
:nextload
if @match(2,Bold)
list 2,delete
goto nextload
else
list 2,seek,0
goto nextload4
end
:nextload4
if @match(2,Italic)
list 2,delete
goto nextload4
else
goto nextload5
end
:nextload5
list list1,assign,2
list list1,seek,@iniread(list,list1)
dialog set,edit1,@item(list1)
list list2,loadtext,
"Regular
"Bold
"Italic
"Bold Italic
list list2,seek,@iniread(list,list2)
dialog set,edit2,@item(list2)
list list3,loadtext,
"8
"9
"10
"11
"12
"14
"16
"18
"20
"22
"24
"26
"28
"36
"48
"72
list list3,seek,@iniread(list,list3)
dialog set,edit3,@item(list3)
list combo1,loadtext,
"Black
"Dkred
"Dkgreen
"Brown
"Dkblue
"Magenta
"Gray
"Silver
"Red
"Ltgreen
"Yellow
"Ltblue
"Cyan
"White
list combo1,seek,@iniread(list,combo1)
goto button3button
:evloop
wait event
goto @event()
:edit1exit
:edit2exit
:edit3exit
goto button3button
:list2click
dialog set,edit2,@item(list2)
goto button3button
:list1click
dialog set,edit1,@item(list1)
goto button3button
:list3click
dialog set,edit3,@item(list3)
goto button3button
:combo1click
goto button3button
:BUTTON1BUTTON
inifile write,font,Face,@dlgtext(edit1)
if @equal(@dlgtext(edit2),Regular)
inifile write,font,format,@chr(32)
else
end
if @equal(@dlgtext(edit2),Bold)
inifile write,font,format,B
else
end
if @equal(@dlgtext(edit2),Italic)
inifile write,font,format,I
else
end
if @equal(@dlgtext(edit2),Bold Italic)
inifile write,font,format,BI
else
end
inifile write,font,Size,@dlgtext(edit3)
inifile write,font,Color,@item(combo1)
goto close
:button3button
inifile write,sample,Face,@dlgtext(edit1)
if @equal(@dlgtext(edit2),Regular)
inifile write,sample,format,@chr(32)
else
end
if @equal(@dlgtext(edit2),Bold)
inifile write,sample,format,B
else
end
if @equal(@dlgtext(edit2),Italic)
inifile write,sample,format,I
else
end
if @equal(@dlgtext(edit2),Bold Italic)
inifile write,sample,format,BI
else
end
inifile write,sample,Size,@dlgtext(edit3)
inifile write,sample,Color,@item(combo1)
window settext,sample box,Sample Box Closing.....
if @not(@null(%1))
run %0 %1 Sample
else
run %0 @windir()\fontdlg.ini sample
end
wait 1
window close,Sample Box Closing.....
goto evloop
:BUTTON2BUTTON
:CLOSE
inifile write,list,list1,@index(list1)
inifile write,list,list2,@index(list2)
inifile write,list,list3,@index(list3)
inifile write,list,combo1,@index(combo1)
window close,sample
exit
:sample
title Sample Box
%a = @iniread(sample,face)
%b = @iniread(sample,size)
%c = @iniread(sample,format)
%d = @iniread(sample,color)
DIALOG CREATE,Sample,-1,,355,160,-
STYLE(STYLE1;%a;%b;%c;;%d),-
DLGTYPE(NOMIN;SMALLCAP;ONTOP;SAVEPOS),-
edit(TEXT1;10;10;330;94;;STYLE1)
window hide,Sample Box
window activate,font
dialog set,text1,AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 1234567890
wait event
goto close2
:close2
exit
|
|
|