Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I uncheck menu item through current form

Status
Not open for further replies.

ameedoo3000

IS-IT--Management
Sep 20, 2016
233
EG
hi all
i have simple form INCLUDE include menu
1_ciqper.png

how can i uncheck orders when clicking command1
 
What is your goal? To only start the orders from once? That's not done via a checked menu item.

Nevertheless the command to set or unset the check mark is [tt]SET MARK OF BAR lnBarNo OF menuFile TO .F.[/tt]
Obviously your form will need to know which bar numbers of which menu names exist.

Bye, Olaf.
 
this is my problem
1- I do not know the menu name (is it Menu1) or what?
2 - Also the name of the bar required to remove the mark in front of him.
2_bfgifi.png

My attempts were as follows
set mark of BAR 1 OF (a_menupops[1]) of menu1 TO .f.
error message
3_afaaaj.png

(My goal is science only)
Please be patient.
 
Well, what is the menu name, if your code says DEFINE MENU m.bMenuName?
And you need to know the bar number, not name.

All the variables used in this code may be local variables, so their scope is during menu definition, they don't exist afterwards, this is something you ougth to know, too. To know something later store it in some form property to be able to use it later.

Bye, Oalf.

 
set mark OF BAR 1 OF (a_menupops[1]) of m.cMenuName TO .f.
the same error
any way thank you very much.
 
I already said those variable (m.cMenuName) might likely be only LOCAL, you can't access it later, the same is valid for a_menupopups[1].

So modify the menu definition code to store a_menupopups[1] into some property you define of the form, which exists later, too.

Look up the meaning of scope in the help. Variables are always scoped in their existence, they don't exist forever and most of them can only be accessed by the code defining them, later are gone. This is not related to the menu at all, this is simply variable scoping.

Bye, Olaf.
 
Besides, the problem you have is about doing something to the menu outside of the menu code, the menu code most probably is generated by the menu designer.

Such a MPR menu prg code is not object oriented, all the menus, popups and bars are defined in the legacy foxpro way like DEFINE WINDOW was defining form in the old foxpro. This mainly means you have names, but these names are not object names and instead of something like Form1.Text1 or Menu1.Bar1 you access Bar 1 of SomeMenuname. There is no THISMENU reference or something alike, so you have to store the things you need more permanent into more permanent variables or properties. That's the one side of this.

The other side is about object orientation. Todays forms are objects themselves, even if you don't know and do object oriented programming, you use objects with forms, you use objects with each and every control on a form, this all is object oriented way of working, and still you can't address THISFORM.menu.bar(1) or such an object, because there isn't. And that's what is the main motivation for the OOP menu project you obviously didn't used, it creates objects, objects, which themselves are not the menu itself, but give object access to the menu. You better go back to learn some basics about OOP before you go back to programming a menu.It's not the easiest, but once you know OOP the OOP menu project will be the simpler thing to use. You better not mix legacy and modern style, that has no good ground to work out flawless.

Bye, Olaf.
 
thank you very very much dear Olaf. I will work with your advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top