| View previous topic :: View next topic |
| Author |
Message |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Wed Mar 24, 2004 2:49 pm Post subject: Menue question / RemoveMenu / DeleteMenue |
|
|
Hi,
as VDS5 triggers clicks on the "main"- menu entry if no submenus are defined I made an option in my app to use office style menues with prakashs popup.dll (he has an example with real menuentries in the menubar).
I found out that vds does not trigger the clicks if I have done some api with the menue (for example hide menue and then insert it again).
So I changed my app to add the menues on login, and remove them on logout.
I use this code:
repeat
%%dummy = @lib(user32,DeleteMenu,BOOL:,%%menubar,1,$400)
%%dummy = @lib(user32,DrawMenuBar,INT:,%%menuBar)
until @equal(@lib(user32,GetMenuItemCount,INT:,%%menubar),1)
If I use normal vds menues this works fine. With the main-menus only (for popup.dll) the app needs around 10 seconds after the loop above to remove the menues. on login (when I re-add the menues) the deleted menues appear again and I have everything duplicated.
Does somebody know what happens here ?
Bye, Fabian |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Mar 24, 2004 4:55 pm Post subject: |
|
|
How do you hide and show the menu? _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Wed Mar 24, 2004 5:37 pm Post subject: |
|
|
Hi,
thanks for your answer.
I have my firstmenu (file) added on run. The other menues are added after login:
| Code: |
#not officestyle:
DIALOG ADD,MENU,Secondmenu,Login,Logout,...
#officestyle
DIALOG ADD,MENU,Secondmenu
|
and the remove on logout:
| Code: |
repeat
%%dummy = @lib(user32,DeleteMenu,BOOL:,%%menubar,1,$400)
%%dummy = @lib(user32,DrawMenuBar,INT:,%%menuBar)
until @equal(@lib(user32,GetMenuItemCount,INT:,%%menubar),1)
|
|
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Wed Mar 24, 2004 5:39 pm Post subject: |
|
|
or did you mean the hiding I used before which made vds not trigger the clicks ?
there I used ssmenu.dll |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Mar 24, 2004 9:44 pm Post subject: |
|
|
| X-Tools wrote: | or did you mean the hiding I used before which made vds not trigger the clicks ?
there I used ssmenu.dll |
Yes, that's what I meant, but the above information was also useful to me.
I have a zcreen magnify program, and I offer the ability to hide the
status bar, and I would like to offer the ability to hide or show the
menu bar also, but did not see how in ssmenu.dll to do that.
I'm sorry, but I don't have a solution to your problem, but I think you have
the solution to my problem  _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Thu Mar 25, 2004 6:56 am Post subject: |
|
|
does somebody know something about the problem ? |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Mar 25, 2004 8:07 am Post subject: |
|
|
You may try to use callback functions to see when the menu is clicked. Maybe this will still work, even if VDS' 'normal' menu events won't work anymore:
| Code: | option msgevent,$111,MenuClick
DIALOG CREATE,Nieuw Dialoog,-1,0,240,160
DIALOG ADD,MENU,MENU1
DIALOG ADD,MENU,MENU2
DIALOG SHOW
:Evloop
wait event
goto @event()
:MenuClick
info You clicked a menu
goto Evloop
:Close
exit |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Thu Mar 25, 2004 8:46 am Post subject: |
|
|
Hi,
nice idea
I there a way to get the name of the clicked menu ? Something like comparing actual mouse position does not work for me, because my menues can have different positions for each user.
Thanks for your help.
Bye, Fabian |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Mar 25, 2004 3:00 pm Post subject: |
|
|
Try this, although I have no idea how this is going to work if you add/remove menu items randomly...
| Code: | option msgevent,$111,MenuClick
DIALOG CREATE,Nieuw Dialoog,-1,0,240,160
DIALOG ADD,MENU,MENU1
DIALOG ADD,MENU,MENU2
DIALOG SHOW
:Evloop
wait event
goto @event()
:MenuClick
info You clicked a menu: @msgparams(W)?
goto Evloop
:Menu1MENU
:Menu2MENU
rem Do nothing
goto Evloop
:Close
exit |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Mon Mar 29, 2004 9:26 am Post subject: |
|
|
Hi,
I don't understand what @msgparams returns - it's not the menu number.
I made an example which shows my problem:
| Code: | %%officemenues =
DIALOG CREATE,Nieuw Dialoog,-1,0,240,160,CLASS pi
if %%officemenues
DIALOG ADD,MENU,File
else
DIALOG ADD,MENU,File,Test,test1,test2
end
DIALOG ADD,BUTTON,login,19,29,64,24,login
DIALOG ADD,BUTTON,logout,62,39,,,logout
DIALOG SHOW
loadlib user32.dll
%%menuBar = @lib(user32.dll,GetMenu,INT:,@strdel(@winexists(#PI),1,1))
:Evloop
wait event
goto @event()
:loginbutton
if %%officemenues
DIALOG ADD,MENU,Bearbeiten
DIALOG ADD,MENU,Test
DIALOG ADD,MENU,Hilfe
else
DIALOG ADD,MENU,Bearbeiten,wef,wefw,efwe
DIALOG ADD,MENU,Test,wefwefwef,wefgrhrt,htr
DIALOG ADD,MENU,Hilfe,wefwef,hrr,ghth,rj4tj
end
goto evloop
:logoutbutton
repeat
%%dummy = @lib(user32.dll,DeleteMenu,BOOL:,%%menubar,1,$400)
%%dummy = @lib(user32.dll,DrawMenuBar,BOOL:,@strdel(@winexists(#PI),1,1))
until @equal(@lib(user32,GetMenuItemCount,INT:,%%menubar),1)
goto evloop
:FileMENU
:DateiMENU
:Menu2MENU
:BearbeitenMENU
:TestMenu
:HilfeMENU
info Click
goto Evloop
:MENUfile
goto loop
:Close
freelib user32.dll
exit
|
After starting hit the login button. Menues are placed on the dialog. Hit logout, and the menues are removed (but still shown, drawmenubar seems not to work. If you minimize and then maximize the window, the menubar is redrawn and the removed menues are away).
Then hit login and the menues are added again.
All works fine.
Then set the firstline (%%officemenues = ) to 1: (%%officemenues = 1)
and try the same. You'll see my problem. The Clicks are still triggered, but all menues are duplicated.
I think the problem is my usage of the API. As I know all menu function return the menu handle. If a menu entry has no child entrys it seems that it has no handle, so possibly deletemenu does not work.
Can an api-guru help me
Bye, Fabian
Last edited by X-Tools on Mon Mar 29, 2004 9:39 am; edited 2 times in total |
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Mon Mar 29, 2004 9:28 am Post subject: |
|
|
| The remove menu problem is solved. I saw my error on @strdel(@winexists(#PI)) (missing params) after sending this post. So now the menues are removed live. But after re-login they are still duplicated. |
|
| Back to top |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Mon Mar 29, 2004 5:56 pm Post subject: |
|
|
| can somebody help me ? |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Mar 29, 2004 10:57 pm Post subject: |
|
|
I'm not sure I understand your problem - but if you're using
popups for sub-menus, you can use TEXT elements with a
"click" style for top level menus (File, Edit. etc.) and they are
easily removed. It just takes a little more code to do the
mouseover/hilight.
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 |
|
 |
X-Tools Valued Contributor

Joined: 20 Sep 2001 Posts: 296 Location: Germany
|
Posted: Tue Mar 30, 2004 5:51 am Post subject: |
|
|
Hi,
thats right. But I offer the user to choose office style menus or not. With the normal menus all works fine, only it the menus don't have childs (what I need to make vdspopup menus), they are removed but not delete from the menubar, so after re-login the appear duplicated. I think there is only a problem with removing when a menu has no childs.
Bye, Fabian |
|
| 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
|
|