S
Stephen Marshall
Guest
I have created a pulldown menu in the CIW.
Menu options are:
Test Function
Remove Test Function
Add Test Function
"Remove Test Function" deletes the entry "Test Function" from the pulldown menu. "Add Test Function" is supposed to check if "Test Function" is there already, and if it's not, add the item back in.
I got the check working, but I can't figure out how to access the menu structure to add the menuItem back in.
Relevant Code Snippets: ("Test Function" is called Woogity... don't ask )
/*****************************************/
/* samCreateMenu() */
/* */
/* main function to create the menu */
/*****************************************/
procedure(samCreateMenu()
samTopBanner = hiInsertBannerMenu(hiGetCIWindow() ;hiGetCurrentWindow()
samPullDown = hiCreatePulldownMenu(
'sam_skill ; handle of the pulldown menu?
"SAM Skill" ; name of the pulldown menu
list(
woogityScript = hiCreateMenuItem( ; 1st menu item creation
?name 'woogity_script
?itemText "Woogity" ; what it will say
?callback "WoogityWoop" ; function that it calls
)
remWoogity = hiCreateMenuItem( ; 2nd menu item creation
?name 'remove_woogity
?itemText "Remove Woogity" ; what it will say
?callback "remove_woogity" ; function that it calls
)
addWoogity = hiCreateMenuItem( ; 3rd menu item creation
?name 'add_woogity_script
?itemText "Add Woogity"
?callback "add_woogity"
)
disWoogity = hiCreateMenuItem( ; 4th menu item creation
?name 'disable_woogity_script
?itemText "Disable Woogity"
?callback "dis_woogity"
)
enWoogity = hiCreateMenuItem( ; 5th menu item creation
?name 'enable_woogity_script
?itemText "Enable Woogity"
?callback "en_woogity"
)
oferFunc = hiCreateMenuItem(
?name 'oferExampleForm
?itemText "Ofer's Example Form"
?callback "oferExample"
)
destrMenu = hiCreateMenuItem(
?name 'destroy_sam
?itemText "Destroy This Menu"
?callback "samDestroyMenu"
)
);list
);createPulldownMenu
hiGetNumMenus(hiGetCIWindow())-2; menu position on the banner
); insertBannerMenu
);procedure
/*****************************************/
/* */
/* Procedures to manipulate the */
/* menu items */
/* */
/*****************************************/
procedure(remove_woogity()
hiDeleteMenuItem(sam_skill 'woogity_script)
printf("Removed Woogity\n")
)
procedure(add_woogity()
menuList = samPullDown->?
cond( ; check if the item is there
(equal(lindex(menuList 'woogity_script) nil)
printf("Woogity is missing! Added Woogity\n") ;;I would put the code to insert it here
)
(numberp(lindex(menuList 'woogity_script))
printf("Woogity is already here! Did not add Woogity\n"))
);cond
/* Now, how I access the existing menu to create the menu item again?
hiCreateMenuItem(
?name 'woogity_script
?itemText "Woogity" ; what it will say
?callback "WoogityWoop" ; function that it calls
)
*/
)
Menu options are:
Test Function
Remove Test Function
Add Test Function
"Remove Test Function" deletes the entry "Test Function" from the pulldown menu. "Add Test Function" is supposed to check if "Test Function" is there already, and if it's not, add the item back in.
I got the check working, but I can't figure out how to access the menu structure to add the menuItem back in.
Relevant Code Snippets: ("Test Function" is called Woogity... don't ask )
/*****************************************/
/* samCreateMenu() */
/* */
/* main function to create the menu */
/*****************************************/
procedure(samCreateMenu()
samTopBanner = hiInsertBannerMenu(hiGetCIWindow() ;hiGetCurrentWindow()
samPullDown = hiCreatePulldownMenu(
'sam_skill ; handle of the pulldown menu?
"SAM Skill" ; name of the pulldown menu
list(
woogityScript = hiCreateMenuItem( ; 1st menu item creation
?name 'woogity_script
?itemText "Woogity" ; what it will say
?callback "WoogityWoop" ; function that it calls
)
remWoogity = hiCreateMenuItem( ; 2nd menu item creation
?name 'remove_woogity
?itemText "Remove Woogity" ; what it will say
?callback "remove_woogity" ; function that it calls
)
addWoogity = hiCreateMenuItem( ; 3rd menu item creation
?name 'add_woogity_script
?itemText "Add Woogity"
?callback "add_woogity"
)
disWoogity = hiCreateMenuItem( ; 4th menu item creation
?name 'disable_woogity_script
?itemText "Disable Woogity"
?callback "dis_woogity"
)
enWoogity = hiCreateMenuItem( ; 5th menu item creation
?name 'enable_woogity_script
?itemText "Enable Woogity"
?callback "en_woogity"
)
oferFunc = hiCreateMenuItem(
?name 'oferExampleForm
?itemText "Ofer's Example Form"
?callback "oferExample"
)
destrMenu = hiCreateMenuItem(
?name 'destroy_sam
?itemText "Destroy This Menu"
?callback "samDestroyMenu"
)
);list
);createPulldownMenu
hiGetNumMenus(hiGetCIWindow())-2; menu position on the banner
); insertBannerMenu
);procedure
/*****************************************/
/* */
/* Procedures to manipulate the */
/* menu items */
/* */
/*****************************************/
procedure(remove_woogity()
hiDeleteMenuItem(sam_skill 'woogity_script)
printf("Removed Woogity\n")
)
procedure(add_woogity()
menuList = samPullDown->?
cond( ; check if the item is there
(equal(lindex(menuList 'woogity_script) nil)
printf("Woogity is missing! Added Woogity\n") ;;I would put the code to insert it here
)
(numberp(lindex(menuList 'woogity_script))
printf("Woogity is already here! Did not add Woogity\n"))
);cond
/* Now, how I access the existing menu to create the menu item again?
hiCreateMenuItem(
?name 'woogity_script
?itemText "Woogity" ; what it will say
?callback "WoogityWoop" ; function that it calls
)
*/
)