how to change a submenu title in PB4 ?

Just starting out? Need help? Post your questions and find answers here.
User avatar
zekitez@lycos.com
User
User
Posts: 15
Joined: Fri Nov 11, 2005 5:42 pm
Location: Netherlands
Contact:

how to change a submenu title in PB4 ?

Post by zekitez@lycos.com »

I want to change the text of a menu. PB4 has:

- SetMenuTitleText to change the text of a menu title and
- SetMenuItemText to change the text of a menu item but

how do you change the text of the submenu ?
A submenu has no ID.
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

Does this help you?

Code: Select all

; You have to calculate the position where the submenu is:
; | Menu [v] |
;  |An Item   | <- Item number 1
;  |An Item   | <- Item Number 2
;  |SubMenu > | <- Item Number 3

Procedure ChangeSubmenuText(Window, Position, Text$)
 ModifyMenu_(GetMenu_(Window), Position, #MF_STRING|#MF_BYPOSITION, 0, Text$)
EndProcedure

; So in the above case: ChangeSubmenuText(WindowID(0), 3, "My new text")
User avatar
zekitez@lycos.com
User
User
Posts: 15
Joined: Fri Nov 11, 2005 5:42 pm
Location: Netherlands
Contact:

about how to change the submenu text

Post by zekitez@lycos.com »

No it did not, whatever I tried it did not change anything.

What did help was simply use
FreeMenu(#Menu)
and then build the whole menu again starting with
CreateMenu(#Menu,....)

Thanks anyway.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

its not well documented in PB4 final :

SetMenuTitleText (#Menu,item,text$) where item begins at 0 ...
SetMenuItemText(#Menu,item,text$) where item begins at 0 ...

Where #Menu is the first menu created

SetMenuTitle : 0 1 2 3 4 5 ...

SetMenuItemText : 0 6 12
SetMenuItemText : 1 7 ...
SetMenuItemText : 2 8
SetMenuItemText : 3 9
SetMenuItemText : 4 10
SetMenuItemText : 5 11
Post Reply