Click menuitem programmatically

General discussion forum about all things Team Developer 6.x
greg
Germany
Posts: 2
Joined: 01 Nov 2017, 12:50
Location: Germany

Click menuitem programmatically

Post by greg » 02 Nov 2017, 06:46

Hi,

I'm looking for a way to "click" a menuitem programmatically.

I defined a named menu with items and action-blocks and uses it in my mdi-form. I scanned the menu and build a cOutlineListBox from the menu-tree. Clicking a list-box item should trigger the menuitem. Any ideas?

Thanks,

Gregor

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

Re: Click menuitem programmatically

Post by Dave Rabelink » 02 Nov 2017, 07:57

I'm not sure what you exactly mean.

You mean to automatically pop up the menu? Or automatically execute the actions of a menu item?

When it is the latter, I would implement a different approach. The menu actions should not be coded in the menu item actions, but execute functionality which can be called from outside the menu.
For instance, the menu item could send a msg to the active form which then has the code to execute the actions.
Or call a function (globally or locally) which has the actions.

When that is the case, you can execute the actions without having a menu at all, just send the message or call the function you need from everywhere.
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

FRBhote
India
Posts: 100
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Click menuitem programmatically

Post by FRBhote » 02 Nov 2017, 11:06

I normally use a hidden pushbutton. Whether the menu item is clicked or required programmatically, I send a click to the button.

greg
Germany
Posts: 2
Joined: 01 Nov 2017, 12:50
Location: Germany

Re: Click menuitem programmatically

Post by greg » 02 Nov 2017, 11:19

Dave Rabelink wrote:
02 Nov 2017, 07:57
Or automatically execute the actions of a menu item?

When it is the latter, I would implement a different approach.
I was thinking about this approch. But even if there is a function-call with parameter in the action-block I cannot scan it and use it in my listbox-menu.
The only thing I get via "vismenu.." is the text and the handle of the item. Maybe the only way is to create both menus from xml-Data dynamicly.

My aim is to have a listbox-menu with the same entries like the MDI or Form-Menu.

Return to “General Discussion”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests