Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Thu Jan 02, 2003 10:59 pm Post subject: A better character map |
|
|
This is the vds 3.x compatible code for my program "A better character map". I initially posted the code at the vds 4.x forum, and cnodnarb was kind enough to edit it to make it compatible with vds 3.x
The code should differentiate between win 95/98/me and xp/w2k. If you are running NT, then you will need to edit part of the code yourself (the section you will need to edit is the section that loads the font list from the registry into list1).
Code: |
%%title = >A Better Character Map
%%version = 1.00
%%date = January 2003
option scale, 96
option decimalsep,"."
Title %%title %%version, Copyright Serge M Botans %%date
DIALOG CREATE,%%title %%version,-1,0,700,540
DIALOG ADD,STATUS,STATUS1,
DIALOG ADD,LIST,LIST1,10,10,160,500,CLICK,SORTED
DIALOG ADD,LIST,LIST2,10,180,25,500,CLICK
DIALOG ADD,BUTTON,UP_BUTTON,440,485,90,30,Move &Up
DIALOG ADD,BUTTON,DOWN_BUTTON,480,485,90,30,Move &Down
DIALOG ADD,BUTTON,CANCEL,440,605,90,30,&Quit
DIALOG ADD,TEXT,ABOUT_T,488,635,60,20,About,,HAND,CLICK
rem === lists the fonts in the windows font folder ===
if @equal(@name(@sysinfo(winver)),5)
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows NT\CurrentVersion\Fonts
else
if @equal(@name(@sysinfo(winver)),4)
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows\CurrentVersion\Fonts
end
end
rem === removes things like (true type) from listing
%i = 0
repeat
list seek, list1, %i
%%dummy = @item(list1)
%%dummy = @substr(%%dummy,1,@fsub(@pos((,%%dummy),1))
list put, list1, %%dummy
%i = @succ(%i)
until @equal(%i,@count(list1))
rem === adds font size to list 2 ===
%i = 6
repeat
list add, list2, %i
%i = @succ(%i)
until @equal(%i,44)
rem === displays first font on list and completes the display of the interface ===
list seek, list1, 0
list seek, list2, 10
dialog add,style,style1,@item(list1),16
dialog add,style,styles1,@item(list1),60
dialog set, status1, Current Font is @item(list1)
%%style_index = 1
%%start = yes
dialog disable, up_button
dialog disable, down_button
gosub draw_buttonsSUB
dialog show
%%start = no
:timer
%%check = @sendmsg(@win(~up_button),$0F2,0,0)
if @equal(%%check,108)@equal(%%check,104)
dialog setpos,text1,@fsub(@dlgpos(text1,t),2),,,
else
end
%%check = @sendmsg(@win(~down_button),$0F2,0,0)
if @equal(%%check,108)@equal(%%check,104)
dialog setpos,text1,@fadd(@dlgpos(text1,t),2),,,
else
end
:evloop
wait event,.1
%%event = @event()
if @greater(@pos(up,%%event),0)
goto %%event
else
if @greater(@pos(down,%%event),0)
goto %%event
end
end
if @greater(@pos(cancel,%%event),0)
goto %%event
else
if @greater(@pos(button,%%event),0)
%%dummy = @strdel(%%event,1,6)
%%dummy = @substr(%%dummy,1,@fsub(@pos(button,%%dummy),1))
if @equal(%%dummy,38)
dialog set, text1, &&
else
dialog set, text1, @chr(%%dummy)
end
dialog set, status1, Current Font is @item(list1) <> This is CHR(%%dummy) <> @chr(%%DUMMY) has been copied to the clipboard.
clipboard set, @chr(%%dummy)
%%move_flag = yes
dialog enable, up_button
dialog enable, down_button
else
goto %%event
end
end
goto evloop
:list2CLICK
:list1CLICK
%%style_index = @succ(%%style_index)
dialog disable, up_button
dialog disable, down_button
dialog add,style,style%%style_index,@item(list1),@item(list2)
dialog add,style,styles%%style_index,@item(list1),60
clipboard clear
dialog set,text1,
dialog set, status1, Current Font is @item(list1)
gosub draw_buttonsSUB
goto evloop
:up_buttonBUTTON
goto evloop
:down_buttonBUTTON
goto evloop
:about_tCLICK
%%about_1 = This program is free for you to use.
%%about_2 = E-Mail: sergeb"@"alphalink.com.au@CR()@CR()Web Site: www.alphalink.com.au/~sergeb
%%about_3 = Copyright © Serge M Botans@CR()Melbourne Australia@CR()%%date@CR()All Rights Reserved
info %%about_1@CR()@CR()%%about_2@CR()@CR()%%about_3
goto evloop
:Close
:cancelBUTTON
exit
:draw_buttonsSUB
rem === draws the buttons ===
%j = 2
%%y_position = 10
repeat
%i = 1
%%x_position = 185
repeat
%%x_position = @fadd(%%x_position,30)
%%button_index = @fadd(@fmul(%j,16),%i)
if @equal(%%start,no)
dialog remove, button%%button_index
end
DIALOG ADD,BUTTON,BUTTON%%button_index,%%y_position,%%x_position,30,30,@chr(@fadd(@fmul(%j,16),%i)),,style%%style_index
if @equal(%%button_index,38)
dialog set, button38, &&
end
%i = @succ(%i)
until @equal(%i,17)
%%y_position = @fadd(%%y_position,30)
%j = @succ(%j)
until @equal(%j,16)
dialog set, button256,
dialog disable, button256
if @equal(%%start,no)
dialog remove, text1
end
dialog add,text,text1,430,390,100,100,,,styles%%style_index
exit
|
Enjoy!
Serge _________________
|
|