BBC BASIC for Windows
« Drop Down Menus »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:11pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Drop Down Menus  (Read 634 times)
GordonSweet
Developer

member is offline

Avatar




PM


Posts: 23
xx Drop Down Menus
« Thread started on: Nov 6th, 2008, 10:05am »

Richard how do we close down all the menu options below so that the pop menu is no longer shown and active, also is it possible to have more than 16 options?
Gordon

SYS "CreatePopupMenu" TO hsub%
:
SYS "CreatePopupMenu" TO hpop1%
SYS "AppendMenu", hpop1%, 0, 1, "&Red"
SYS "AppendMenu", hpop1%, 0, 2, "&Green"
SYS "AppendMenu", hpop1%, 0, 4, "&Blue"
SYS "AppendMenu", hpop1%, 0, 3, "&Yellow"
SYS "AppendMenu", hpop1%, 0, 5, "&Magenta"
SYS "AppendMenu", hpop1%, 0, 6, "&Cyan"
:
SYS "CreateMenu" TO hmenu%
SYS "AppendMenu", hmenu%, 16, hpop1%, "&Primary"
SYS "SetMenu", @hwnd%, hmenu%
SYS "DrawMenuBar", @hwnd%
:
ON SYS PROCmenu(@wparam%) : RETURN
REPEAT UNTIL INKEY(10)=0
END
:
DEF PROCmenu(col%)
PRINTcol%
ENDPROC

User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Drop Down Menus
« Reply #1 on: Nov 6th, 2008, 12:31pm »

Quote:
how do we close down all the menu options

It's a relatively unusual thing to want to do, but you can use SYS "DestroyMenu" to get rid of any menus you have created:

Code:
      SYS "DestroyMenu", hpop1%
      SYS "DestroyMenu", hmenu% 


Quote:
is it possible to have more than 16 options

Yes, there's no practical limit. Think of the right-click context menu in the BB4W IDE (the one that lists all the procedures and functions). That commonly has hundreds of items.

Richard.
User IP Logged

GordonSweet
Developer

member is offline

Avatar




PM


Posts: 23
xx Re: Drop Down Menus
« Reply #2 on: Nov 6th, 2008, 1:24pm »

Thanks Richard but I must be doing something wrong below. Gordon

Code:
      SYS "CreatePopupMenu" TO hsub%
      :
      SYS "CreatePopupMenu" TO hpop1%
      SYS "AppendMenu", hpop1%, 0, 1, "&Red"
      SYS "AppendMenu", hpop1%, 0, 2, "&Green"
      SYS "AppendMenu", hpop1%, 0, 4, "&Blue"
      SYS "AppendMenu", hpop1%, 0, 3, "&Yellow"
      SYS "AppendMenu", hpop1%, 0, 5, "&Magenta"
      SYS "AppendMenu", hpop1%, 0, 6, "&Cyan"
      :
      SYS "CreateMenu" TO hmenu%
      SYS "AppendMenu", hmenu%, 16, hpop1%, "&Primary"
      SYS "SetMenu", @hwnd%, hmenu%
      SYS "DrawMenuBar", @hwnd%
      :
      ON SYS PROCmenu(@wparam%) : RETURN
      REPEAT UNTIL INKEY$(10)="/"
      SYS "DestroyMenu", hpop1%
      SYS "DestroyMenu", hmenu%
      G=GET : QUIT
      END
      :
      DEF PROCmenu(col%)
      PRINTcol%
      ENDPROC
 
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Drop Down Menus
« Reply #3 on: Nov 6th, 2008, 2:32pm »

Quote:
Thanks Richard but I must be doing something wrong

Before you can destroy the main menu you need to 'detach' it from the window:

Code:
      SYS "SetMenu", @hwnd%, 0
      SYS "DestroyMenu", hpop1%
      SYS "DestroyMenu", hmenu% 

Richard.
User IP Logged

GordonSweet
Developer

member is offline

Avatar




PM


Posts: 23
xx Re: Drop Down Menus
« Reply #4 on: Nov 6th, 2008, 5:17pm »

Thanks again Richard I neded it to upgrade my HTML coder that also reformats text Pasted from the clipboard. I will publish it when finished in the Yahoo Group's Files

Gordon
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls