Solved Popup menus

Discussion forum about all things Team Developer 5.x and 6.x
DocData3d

Popup menus

Post by DocData3d » 20 Dec 2007, 19:37

I have a popup menu that when I build it I issue numerous commands like...

Call AppendMenuA( hWndUMenuTracking, MF_DISABLED | MF_GRAYED, nCtr, 'Select and add Dynamic Field...' )

Call AppendMenuA( hWndUMenuTracking, MF_EBALED, nCtr, 'Some other text' )

All the options are grayed out and the popup is unusable. This code works in 3.1 with the appropriate options being enabled or disabled/grayed running on the same PC/same code.

Is there a change in 5.1 that affects this?

I don't know if this is pre SP or not.

Dave

jmcnamara

Re: Popup menus

Post by jmcnamara » 21 Dec 2007, 00:00

DocData3d wrote:...Call AppendMenuA( hWndUMenuTracking, :oops: MF_EBALED :oops: , nCtr, 'Some other text' )...
If you copied and pasted your code snip-its this could be your problem. :roll:

DocData3d

Re: Popup menus

Post by DocData3d » 21 Dec 2007, 15:46

That's a pretty nasty assumption. Sorry to disappoint but that was a case of FFT (fat fingered typing) here on the forum but not in the code. The code has 'MF_ENABLED'.

DocData3d

Re: Popup menus

Post by DocData3d » 27 Dec 2007, 22:40

Anyone got any other ideas?

cschubert
Germany
Posts: 867
Joined: 23 May 2018, 11:26
Location: Germany

Re: Popup menus

Post by cschubert » 27 Dec 2007, 23:06

Dave,

Windows SDK menu functions will not longer work with TD 5.1 due to the new skinning library used. The menus you see are no longer generic Windows menus. With SP1 the VisMenu* functions should do the trick....

HTH

Christian Schubert

TPo

Re: Popup menus

Post by TPo » 02 Jan 2008, 10:51

Hi!

Since we cannot use any SDK functions in TD 5.1, how I can create popup menu's with VisMenu* functions?

I have done dynamically created menu structure with popup menu's in TD 3.1 with SDK functions GetMenu, CreatePopupMenu,
InsertMenuA and AppendMenuA and those have been working fine.

If anybody has an example how to do it with VisMenu* functions I would be very pleased.

This works with TD 3.1. In real life data is coming from database and there's about 150 menu items....

Function: fCreateDynamicMenusTest
Description:
Returns
Parameters
Static Variables
Local variables
Window Handle: hWndMenuMain
Window Handle: hWndPopupMenu
Window Handle: hWndPopupPopupMenu
Actions
!
Set hWndMenuMain = GetMenu( hWndMDI )
!
Set hWndPopupMenu = CreatePopupMenu( )
Call InsertMenuA( hWndMenuMain, 0, MF_POPUP | MF_BYPOSITION | MF_STRING, SalWindowHandleToNumber(hWndPopupMenu ) , 'DYNAMIC POPUP')
!
Set hWndPopupPopupMenu = CreatePopupMenu( )
Call InsertMenuA( hWndPopupMenu, 0xFFFFFFFF, MF_POPUP | MF_BYPOSITION|MF_STRING , SalWindowHandleToNumber(hWndPopupPopupMenu ),'Submenu 1')
Call AppendMenuA( hWndPopupPopupMenu, 0, 1, 'Menu Item of submenu 1' )
Call AppendMenuA( hWndPopupPopupMenu, 0, 2, 'Menu Item 2 of submenu 1' )
Call AppendMenuA( hWndPopupPopupMenu, MF_SEPARATOR, 0, '' )
Call AppendMenuA( hWndPopupPopupMenu, 0, 3, 'Menu Item 3 of submenu 1' )
!
Call AppendMenuA( hWndPopupMenu, MF_SEPARATOR, 0, '' )
Call AppendMenuA( hWndPopupMenu, 0, 5, 'Menu Item 1 of Dynamic popup' )
Set hWndPopupPopupMenu = CreatePopupMenu( )
Call InsertMenuA( hWndPopupMenu, 0xFFFFFFFF, MF_POPUP | MF_BYPOSITION|MF_STRING , SalWindowHandleToNumber(hWndPopupPopupMenu ),'Submenu 2')
Call AppendMenuA( hWndPopupPopupMenu, 0, 11, 'Menu Item of submenu 2' )
Call AppendMenuA( hWndPopupPopupMenu, 0, 12, 'Menu Item 2 of submenu 2' )
Call AppendMenuA( hWndPopupPopupMenu, MF_SEPARATOR, 0, '' )
Call AppendMenuA( hWndPopupPopupMenu, 0, 13, 'Menu Item 3 of submenu 2' )
!
Set hWndPopupMenu = CreatePopupMenu( )
Call InsertMenuA( hWndMenuMain, 1, MF_POPUP | MF_BYPOSITION | MF_STRING, SalWindowHandleToNumber(hWndPopupMenu ) , 'DYNAMIC POPUP 2')
!
Set hWndPopupPopupMenu = CreatePopupMenu( )
Call InsertMenuA( hWndPopupMenu, 0xFFFFFFFF, MF_POPUP | MF_BYPOSITION|MF_STRING , SalWindowHandleToNumber(hWndPopupPopupMenu ),'Submenu 1')
Call AppendMenuA( hWndPopupPopupMenu, 0, 101, 'Menu Item of submenu 1' )
Call AppendMenuA( hWndPopupPopupMenu, 0, 102, 'Menu Item 2 of submenu 1' )
Call AppendMenuA( hWndPopupPopupMenu, MF_SEPARATOR, 0, '' )
Call AppendMenuA( hWndPopupPopupMenu, 0, 103, 'Menu Item 3 of submenu 1' )
!
Set hWndPopupPopupMenu = CreatePopupMenu( )
Call InsertMenuA( hWndPopupMenu, 0xFFFFFFFF, MF_POPUP | MF_BYPOSITION|MF_STRING , SalWindowHandleToNumber(hWndPopupPopupMenu ),'Submenu 2')
Call AppendMenuA( hWndPopupPopupMenu, 0, 111, 'Menu Item of submenu 2' )
Call AppendMenuA( hWndPopupPopupMenu, 0, 112, 'Menu Item 2 of submenu 2' )
Call AppendMenuA( hWndPopupPopupMenu, MF_SEPARATOR, 0, '' )
Call AppendMenuA( hWndPopupPopupMenu, 0, 113, 'Menu Item 3 of submenu 2' )
!
Call DrawMenuBar( hWndMDI )


Thanks in anvance...

Teuvo

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3388
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Popup menus

Post by Dave Rabelink » 03 Jan 2008, 19:30

Here a testcase which works in TD5.1 sp1

You should use the W api functions (eg AppendMenuW).


Dave
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

TPo

Re: Popup menus

Post by TPo » 07 Jan 2008, 14:47

Hi!

Thank you Dave!

Are there also new functions for GetMenu & CreatePopupMenu & InsertMenuA ? I need to create menu structure for MDI with several submenus....
Or does anybody know if there's a plan to add new functions to visual toochest? Like VisMenuInsertPopup?

Where could I find prototypes for W Api functions (I have old WINAPI32.APL where I have found all these old one's I have used)
that work with TD 5.1?

Teuvo

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests