Page 1 of 1
how to change a submenu title in PB4 ?
Posted: Mon May 08, 2006 7:35 pm
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.
Posted: Mon May 08, 2006 8:32 pm
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")
about how to change the submenu text
Posted: Wed May 10, 2006 6:25 pm
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.
Posted: Thu May 11, 2006 11:33 am
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