View previous topic :: View next topic |
Author |
Message |
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Dec 30, 2002 1:18 pm Post subject: A better character map |
|
|
As they say, "necessity is the mother of invention". So, following my post about using webdings and wingdings characters for buttons on toolbars, i found the Windows version of Character Map inadequate for my needs. Specifically, the characters were too small for me to see them. So, i made my own Character Map. You will find the full code below. Feel free to compile it and use it - if you find it useful
By the way, i can't get the character "&" to be displayed and some characters are not copied properly to the clipboard - anyone have any idea why that might be the case?
Code: |
%%title = >A Better Character Map
%%version = 1.00
%%date = January 2003
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,Font List,CLICK,SORTED
DIALOG ADD,LIST,LIST2,10,180,25,500,Font Size,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 ===
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows\CurrentVersion\Fonts
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
:evloop
wait event
%%event = @event()
if @greater(@pos(up,%%event),0)
goto %%event
elsif @greater(@pos(down,%%event),0)
goto %%event
elsif @greater(@pos(cancel,%%event),0)
goto %%event
elsif @greater(@pos(button,%%event),0)
%%dummy = @strdel(%%event,1,6)
%%dummy = @substr(%%dummy,1,@fsub(@pos(button,%%dummy),1))
rem dialog set, button_big, @chr(%%dummy)
dialog set, text1, @chr(%%dummy)
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
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
dialog setpos,text1,@fsub(@dlgpos(text1,t),2),,,
goto evloop
:down_buttonBUTTON
dialog setpos,text1,@fadd(@dlgpos(text1,t),2),,,
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
%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
dialog set, button38, @chr(38)
if @equal(%%start,no)
rem dialog remove, button_big
dialog remove, text1
end
rem dialog add,button,button_big,435,380,80,80,,,styles%%style_index
dialog add,text,text1,430,390,100,100,,,styles%%style_index
exit
|
Enjoy!
Serge _________________
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Dec 30, 2002 1:26 pm Post subject: |
|
|
ooopppsss...forgot to add that you can change the code to make it work the way you want it to - if that is something that you would like to do.
The code i gave above is for the version that i will release at my web site as freeware.
Serge _________________
|
|
Back to top |
|
|
Rubes_sw Valued Contributor
Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Mon Dec 30, 2002 1:50 pm Post subject: |
|
|
Code above does not work with:
Windows XP Pro.
Rubes_sw |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
Posted: Mon Dec 30, 2002 2:09 pm Post subject: |
|
|
Dr. Dread gave this solution here:
http://www.vdsworld.com/forum/viewtopic.php?t=407
For compatibility, here the registry line should be replaced with this. Not my ideal, thank Dr. Dread!
Code: |
if @equal(@name(@sysinfo(winver),5))@equal(@sysinfo(winver),"4.0")
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows NT\CurrentVersion\Fonts
else
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows\CurrentVersion\Fonts
end
|
NodNarb |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
Posted: Mon Dec 30, 2002 2:16 pm Post subject: |
|
|
For amperstands to appear you have to use two in a row. &&
Also, be very careful about using the word "Better" ROFL see this topic for details!
http://www.vdsworld.com/forum/viewtopic.php?t=1031
NodNarb
EDIT Oops!
Program not VDS 3 compatible.
Old Post Start
For VDS 3.x compatibility I had to remove the "Font List" and "Font Size" styles from list1 and list2 respectively. |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Dec 30, 2002 9:15 pm Post subject: |
|
|
Hi cnodnarb,
- thanks for the && tip, i will make the necessary changes and update the code listing,
- the code you gave me for it to work under NT/XP/95/98/... doesn't work. According to the code, my computer running ME is processed as NT!?!
- i never meant for the code to work under vds 3.x which is why i posted it here did i do something wrong?
- i take your point about "better" i meant better in the sense that it better suits my needs
Serge _________________
|
|
Back to top |
|
|
MarkTrubo Contributor
Joined: 27 May 2001 Posts: 148 Location: Long Island, NY
|
Posted: Mon Dec 30, 2002 10:46 pm Post subject: |
|
|
Tested it "as is" and it did not work on XP Home Edition. Made the change suggested:
if @equal(@name(@sysinfo(winver),5))@equal(@sysinfo(winver),"4.0")
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows NT\CurrentVersion\Fonts
else
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows\CurrentVersion\Fonts
end
And is works great -- I really like it! |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
Posted: Tue Dec 31, 2002 12:19 am Post subject: |
|
|
Hmm...looks like you might have to make two codes then, one compatible with 95/98/me and one for xp/nt 4/2000. They won't be that much different Either that or update the reg check routine somehow...
You did absolutely nothing wrong!! Its just a shame vds 3.x users (like me) lose out on using such a good program!!
NodNarb |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Dec 31, 2002 8:06 am Post subject: |
|
|
i'll see what can do about making the code work under all versions of windows but i need to know the font registry setting for all versions of windows.
i take it that for win 95, 98 and ME, it is:
Code: |
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows\CurrentVersion\Fonts
|
what about NT, w2k and XP? could someone confirm that the following code is correct for these versions of windows...
Code: |
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows NT\CurrentVersion\Fonts
|
thanks in anticipation
Serge
ps thanks to cnodnarb, i will be posting a vds 3.x version of my code in the next few days _________________
|
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Tue Dec 31, 2002 9:07 am Post subject: |
|
|
Hey Serge
The reg path stated is OK for WinXP + Win2K here.
To check why the reg check mentioned fails, try to do a
Code: | info @sysinfo(winver) |
on your ME system. Then it should be easy to adjust for that.
Greetz
Dr. Dread
PS: A really happy New Year to everyone here. Cheers. _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Thu Jan 02, 2003 10:49 pm Post subject: |
|
|
Thanks to all for your feedback and your help. I have implemented what i think will make my program differentiate between win 95/98/me and xp/w2k. (ME is reported by VDS as version 4.90) If you are running NT, you will need to amend the code by hand yourself as NT is reported by VDS as version 4.x (same as win 95/98/me) - that is my understanding anyway
I have also made the necessary changes so that "&" is displayed.
Thanks to cnodnarb also for showing me how to alter the code to make the up and down buttons work better.
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,Font List,CLICK,SORTED
DIALOG ADD,LIST,LIST2,10,180,25,500,Font Size,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
elsif @equal(@name(@sysinfo(winver)),4)
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows\CurrentVersion\Fonts
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
elsif @greater(@pos(down,%%event),0)
goto %%event
elsif @greater(@pos(cancel,%%event),0)
goto %%event
elsif @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
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
rem dialog setpos,text1,@fsub(@dlgpos(text1,t),2),,,
goto evloop
:down_buttonBUTTON
rem dialog setpos,text1,@fadd(@dlgpos(text1,t),2),,,
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
|
I will add the code compatible with vds 3.x to the vds 3.x forum, for those of you who run vds 3.x
Serge _________________
|
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Jan 02, 2003 11:37 pm Post subject: |
|
|
If your ME reports back as 4.90, Serge, then the code piece mentioned by Nodnarb should work
just fine! So why doesn't it? Because yours truly made a parentheses mistake in the original
code line
He-he. And just no-one here (including myself ..) spotted that
I think we're all getting old - or is everyone hung over ???
This one should work better:
Code: |
if @equal(@name(@sysinfo(winver)),5)@equal(@sysinfo(winver),"4.0")
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows NT\CurrentVersion\Fonts
else
LIST REGVALS,list1,LOCAL,Software\Microsoft\Windows\CurrentVersion\Fonts
end
|
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing
Last edited by Dr. Dread on Thu Jan 02, 2003 11:47 pm; edited 1 time in total |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Jan 02, 2003 11:42 pm Post subject: |
|
|
Serge wrote: |
Thanks to cnodnarb also for showing me how to alter the code to make the up and down buttons work better.
|
If you want your up and down buttons to work even better, then perhaps you should remove
the REM commands from those two code sections
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
Posted: Fri Jan 03, 2003 2:49 am Post subject: |
|
|
LoL He did that to display how the buttons used to be coded...the buttons are now handled in the :timer event...more comments would probably help clear that up Serge!
NodNarb |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Jan 03, 2003 7:42 am Post subject: |
|
|
Hmmmmm, the problem is - when those lines are remmed out, nothing happens here! Perhaps that
API command does not return the same values everywhere. I get 520 when pressing the up button
and 0 for the down button. And then you don't end up with much when the check in the timer section
looks for 104 and 108.
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|