forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Custom POPUP menu...
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Mon Jan 07, 2002 10:30 pm    Post subject: Custom POPUP menu... Reply with quote

-- VDS3 and VDS4 Compatible --

Here's a custom menu example using a child dialog
that will allow you to put icons, etc. in the menu items.
I used "Wingding" fonts for the Menu icons, but you can
use BITMAP elements (with CLICK style) if you want.
_______________________________________________________________________________________________________________________________________________________
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
  DIALOG CREATE,"Main Test Window",-1,0,200,100,CLICK
  DIALOG ADD,Text,T1,5,5,,,"Right click anywhere"
  DIALOG SHOW

:EVLOOP
  WAIT EVENT
  rem -- %e is event, %d is dialog number that issued it (0,1,2,etc.)--
  Parse "%e;%d", @event(D)
  goto %e

:CLICK
  PARSE "%b;%x;%y",@click(BXY)
  rem -- Open menu on right click only --
  if @equal(%b, "RIGHT")
     rem -- In case menu is already open --
     GOSUB CLoseMenu
     rem -- Store the Menu child window ID number --
     %%menu = @succ(%d)
     DIALOG CREATE,"Menu",@sum(%y,@winpos("Main Test Window",T)),@sum(%x,@winpos("Main Test Window",L)),100,70,NOTITLE
     DIALOG ADD,STYLE,Style1,,,,WHITE
     DIALOG ADD,STYLE,Style2,,,,BLACK
     DIALOG ADD,STYLE,Style3,Wingdings,11

     rem -- Draw the trim for the menu box --
     DIALOG ADD,TEXT,TOP,0,0,100,1,,,Style1
     DIALOG ADD,TEXT,LEFT,0,0,1,70,,,Style1
     DIALOG ADD,TEXT,BOTTOM,69,0,100,1,,,Style2
     DIALOG ADD,TEXT,RIGHT,0,99,1,70,,,Style2

     DIALOG ADD,TEXT,Menu1icon,5,5,,,@chr(49),,Style3,CLICK
     DIALOG ADD,TEXT,Menu1,5,30,,,"File Open",,CLICK

     DIALOG ADD,TEXT,Menu2icon,25,5,,,@chr(60),,Style3,CLICK
     DIALOG ADD,TEXT,Menu2,25,30,,,"Save",,CLICK

     DIALOG ADD,GROUP,MenuLine,45,2,96,1,,,Style1

     DIALOG ADD,TEXT,Menu3icon,50,5,,,@chr(77),,Style3,CLICK
     DIALOG ADD,TEXT,Menu3,50,30,,,"Exit",,CLICK
     DIALOG SHOW
  else
     GOSUB CloseMenu
  end
  goto EVLOOP

:Menu1iconCLICK
:Menu1CLICK
  GOSUB CloseMenu
  %f = @filedlg()
  goto EVLOOP

:Menu2iconCLICK
:Menu2CLICK
  GOSUB CloseMenu
  INFO Save something here. @tab()
  goto EVLOOP

:Menu3iconCLICK
:Menu3CLICK
  GOSUB CloseMenu
:CLOSE
  EXIT

rem ---- GOSUB ROUTINES ----

:CloseMenu
  if %%menu
     DIALOG SELECT, %%menu
     DIALOG CLOSE, %%menu
     %e = @event()
     %%menu = ""
  end
  exit

[EDIT]
Changed the MenuLine from a "TEXT" to a "GROUP" element.
Thanks to Snarling Sheep for this idea.

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361


Last edited by Mac on Sun Jan 13, 2002 11:23 am; edited 4 times in total
Back to top
View user's profile Send private message Send e-mail
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1537

PostPosted: Mon Jan 07, 2002 11:10 pm    Post subject: Reply with quote

Amazing. I've never seen anyone think of this idea before. Very nice work Mac.
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Mon Jan 07, 2002 11:18 pm    Post subject: Reply with quote

Thanks Prakash, Smile

BTW, the CLASS style is unnecessary on the child window.
I was playing around with it and forgot to remove it... Embarassed

[EDIT]
I removed the CLASS style and adjusted the "MenuLine".

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Jan 08, 2002 4:17 am    Post subject: Reply with quote

Nice Mac Smile
This is a bit lengthy, but it will highlight the menu item on mouseover.

Code:

See Page 2

_________________
-Sheep
My pockets hurt...


Last edited by SnarlingSheep on Sun Jan 13, 2002 1:50 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2146
Location: A House

PostPosted: Tue Jan 08, 2002 7:08 am    Post subject: Reply with quote

I couldn't help but make the menu more realistic with the proper colors for the borders Smile

Code:
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
  DIALOG CREATE,"Main Test Window",-1,0,200,100,CLICK
  DIALOG ADD,Text,T1,5,5,,,"Right click anywhere"
  DIALOG SHOW

:EVLOOP
  WAIT EVENT
  rem -- %e is event, %d is dialog number that issued it (0,1,2,etc.)--
  Parse "%e;%d", @event(D)
  goto %e

:CLICK
  PARSE "%b;%x;%y",@click(BXY)
  rem -- Open menu on right click only --
  if @equal(%b, "RIGHT")
     rem -- In case menu is already open --
     GOSUB CLoseMenu
     rem -- Store the Menu child window ID number --
     Option Fieldsep,@chr(32)
     %A = @regread(CURUSER,Control Panel\Colors,ButtonLight)
     Parse "%R;%G;%B",%A
     %%ButtonLightColor = $00@hex(%B,2)@hex(%G,2)@hex(%R,2)
     %A = @regread(CURUSER,Control Panel\Colors,ButtonHilight)
     Parse "%R;%G;%B",%A
     %%ButtonHilightColor = $00@hex(%B,2)@hex(%G,2)@hex(%R,2)
     %A = @regread(CURUSER,Control Panel\Colors,ButtonShadow)
     Parse "%R;%G;%B",%A
     %%ButtonShadowColor = $00@hex(%B,2)@hex(%G,2)@hex(%R,2)
     %A = @regread(CURUSER,Control Panel\Colors,ButtonDkShadow)
     Parse "%R;%G;%B",%A
     %%ButtonDkShadowColor = $00@hex(%B,2)@hex(%G,2)@hex(%R,2)
     %%menu = @succ(%d)
     DIALOG CREATE,"Menu",@sum(%y,@winpos("Main Test Window",T)),@sum(%x,@winpos("Main Test Window",L)),100,70,NOTITLE
     DIALOG ADD,STYLE,Style1,,,,%%ButtonLightColor
     DIALOG ADD,STYLE,Style1b,,,,%%ButtonHilightColor
     DIALOG ADD,STYLE,Style2,,,,%%ButtonDkShadowColor
     DIALOG ADD,STYLE,Style2b,,,,%%ButtonShadowColor
     DIALOG ADD,STYLE,Style3,Wingdings,11
     rem -- Draw the trim for the menu box --
     DIALOG ADD,TEXT,TOP,0,0,100,1,,,Style1
     DIALOG ADD,TEXT,TOP2,1,1,99,1,,,Style1b
     DIALOG ADD,TEXT,LEFT,0,0,1,70,,,Style1
     DIALOG ADD,TEXT,LEFT2,1,1,1,69,,,Style1b
     DIALOG ADD,TEXT,BOTTOM,69,0,100,1,,,Style2
     DIALOG ADD,TEXT,BOTTOM2,68,1,99,1,,,Style2b
     DIALOG ADD,TEXT,RIGHT,0,99,1,70,,,Style2
     DIALOG ADD,TEXT,RIGHT2,1,98,1,68,,,Style2b
     DIALOG ADD,TEXT,Menu1icon,5,5,,,@chr(49),,Style3,CLICK
     DIALOG ADD,TEXT,Menu1,5,30,,,"File Open",,CLICK
     DIALOG ADD,TEXT,Menu2icon,25,5,,,@chr(60),,Style3,CLICK
     DIALOG ADD,TEXT,Menu2,25,30,,,"Save",,CLICK
     DIALOG ADD,TEXT,MenuLine2,44,4,92,1,,,Style2b
     DIALOG ADD,TEXT,MenuLine,45,4,92,1,,,Style1b
     DIALOG ADD,TEXT,Menu3icon,50,5,,,@chr(77),,Style3,CLICK
     DIALOG ADD,TEXT,Menu3,50,30,,,"Exit",,CLICK
     DIALOG SHOW
  else
     GOSUB CloseMenu
  end
  goto EVLOOP

:Menu1iconCLICK
:Menu1CLICK
  GOSUB CloseMenu
  %f = @filedlg()
  goto EVLOOP

:Menu2iconCLICK
:Menu2CLICK
  GOSUB CloseMenu
  INFO Save something here. @tab()
  goto EVLOOP

:Menu3iconCLICK
:Menu3CLICK
  GOSUB CloseMenu
:CLOSE
  EXIT

rem ---- GOSUB ROUTINES ----

:CloseMenu
  if %%menu
     DIALOG SELECT, %%menu
     DIALOG CLOSE, %%menu
     %e = @event()
     %%menu = ""
  end
  exit

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
http://www.freewarehome.com <-- Freeware listings since 1996
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Jan 08, 2002 8:55 am    Post subject: Reply with quote

Nice going Sheep. You could also add some
spaces (or use a width on the text elements)
and highlight it all the way across. Smile

What system are you running Garrett? I made it
to match Windows 95. Your changes made a very
wide solid black border on my system...

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Tue Jan 08, 2002 12:36 pm    Post subject: Reply with quote

Laughing This is amazing! Great example! Definetly going to be useful to a lot of VDS people.!!!

Thanks Mac ! And Garrett and SnarlingSheep!


Marty
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2146
Location: A House

PostPosted: Wed Jan 09, 2002 5:42 pm    Post subject: Reply with quote

Mac, I'm on Win98. What I added is suppose to just grab the system colors from the registry and then use those in the STYLE commands. Unless 95 didn't have these registry settings?

Can you check your registry for the @regread() entries I have on that?

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
http://www.freewarehome.com <-- Freeware listings since 1996
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Jan 09, 2002 10:55 pm    Post subject: Reply with quote

Hey Garrett, Smile

Apparently that's the problem.

I have "HK_CURRENT_USER\Control Panel",
but no "Color" subkey.

And a registry search fails to find these anywhere:

ButtonLight
ButtonHilight
ButtonShadow
ButtonDkShadow

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2146
Location: A House

PostPosted: Fri Jan 11, 2002 12:07 am    Post subject: Reply with quote

Bet 95 uses the win.ini settings instead then.

I know 98 also still has the color settings in the win.ini also, but obviously it uses the registry entries instead, and I know win2k doesn't.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
http://www.freewarehome.com <-- Freeware listings since 1996
Back to top
View user's profile Send private message
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 737
Location: The Netherlands

PostPosted: Fri Jan 11, 2002 8:39 pm    Post subject: Reply with quote

If the values you are trying to read don't exist, it's supposed to use default values instead.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Jan 11, 2002 10:00 pm    Post subject: Reply with quote

Hey Tommy, Smile

Hmmm... well, Garrett's routine makes about a 1/16 inch (1.6 mm )
solid black border all the way around the menu, and the same size
for the menu line.

I also couldn't find any reference to the settings in WIN.INI or
SYSTEM.INI... Sad

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2146
Location: A House

PostPosted: Sat Jan 12, 2002 12:31 am    Post subject: Reply with quote

No way! that just can't be! Where in the heck are the color settings being stored on your system?????

Anybody else out there with a verion Win95 sitting on a box that can check into this on theirs??

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
http://www.freewarehome.com <-- Freeware listings since 1996
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Jan 12, 2002 12:52 am    Post subject: Reply with quote

Maybe popup menu styles, etc. are built into each scheme?
_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1537

PostPosted: Sat Jan 12, 2002 4:25 am    Post subject: Reply with quote

I tried running the code Garret posted and it doesnt work for me either, infact it shows no highlight at all, none under the text or any visual appearance of a mouse over. Using Windows XP Home with the Silver theme. Here are my registry settings:

ButtonLight: 241 239 226
ButtonHilight: 255 255 255
ButtonShadow: 157 157 161
ButtonDkShadow: 113 111 100
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
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




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group