Wimp_CreateMenu
Bryan (8467) 468 posts |
I am trying to write the code to create a menu with a an errow to a program info box The menu appears and if I move the mouse right over the Info menu option, then “About this Program” window appears. But I do not see an arrow on the Info menu item. My code is as below. What am I missing, please? DEF PROCmake_menu(menu_title$,menu_x%,menu_y%) DIM menu_block% 512 FORg%=0 TO 511: menu_block%?g%=0: NEXT g% $menu_block% = menu_title$ menu_block%?12 = 7 menu_block%?13 = 2 menu_block%?14 = 7 menu_block%?15 = 0 menu_block%!16 = 100 menu_block%!20 = 44 menu_block%!24 = 0 menu_block%!(28+0*24+0)=1<<4 : REM menu item 1 menu_block%!(28+0*24+4)=-1 menu_block%!(28+0*24+8)=&07000001 $(menu_block%+28+0*24+12)="Info" menu_block%!(28+1*24+0)=0: REM menu item 2 menu_block%!(28+1*24+4)=-1 menu_block%!(28+1*24+8)=&07000001 $(menu_block%+28+1*24+12)="Help" menu_block%!(28+2*24+0)=1<<7: REM menu item 3 menu_block%!(28+2*24+4)=-1 menu_block%!(28+2*24+8)=&07000001 $(menu_block%+28+2*24+12)="Quit" SYS "Wimp_CreateMenu",,menu_block%,menu_x,menu_y% PROCwimp_attachsubmenu(menu_block%,1,info%) ENDPROC DEF PROCwimp_attachsubmenu(menu%,item%,sub_menu%) !(menu%+8+(item%*24))=sub_menu% ENDPROC |
Graeme (8815) 106 posts |
Wimp_CreateMenu will show the menu immediately. You have called this without a submenu in the Info item (you are adding it afterwards). So the Wimp draws it as if it has no submenu and therefore no arrows. You need to attach the submenu before calling createmenu so the arrow is drawn. |
Bryan (8467) 468 posts |
Thank you for that. It sounds logical. If I have understood you correctly, then swapping the last two lines of my make_menu procedure is what is needed. Unfortunately, the result is no different. The arrow is not drawn but the info box still appears as the mouse is moved over where it should have been. |
Bryan (8467) 468 posts |
Your reply got me thinking and I have now found the bug and the arrow now appears. Thank you. The attach_menu code now reads DEF PROCwimp_attachsubmenu(menu%,item%,sub_menu%) !(menu%+28+(item%*24)+4)=sub_menu% ENDPROC I had tried that previously but, of course, to no effect without your correction. |