
FB II Compiler
PG PRO
Debugging
Memory
System
Mathematics
Resources
Disk I/O
Windows
Controls
Menus
Mouse
Keyboard
Text
Fonts
Drawing
Sound
Clipboard
Printing
Communication
ASM
|
MENUS
Use popup menu like a control
Weee, no more DEF SHOWPOP, DEF SHADOWBOX etc...
The following code will use the proper system pop-up CDEF , and Jam it into the FB button list. Then you will get a Button event when the pop-up is selected. Use SCROLL BUTTON to set the popu-menu, and x% = BUTTON(id) to get the value of the menu. The Settings% paramater will take things like _useWndFont etc. You will also need a menu resource as specified by MenuResID%.
It will also do all the left & Right justification, Fixed Width,No title pop-ups etc,etc just have a flick thru IM to find out how, it would take me too long to go thru all the options...
CLEAR LOCAL
LOCAL FN PopupMenuButton(theName$,IDtoUse%,MenuResID%,theRect&,Settings%)
myWindow& = WINDOW(_wndPointer)
LONG IF myWindow& > 0
_PopupMenuProc = 1009
Settings% = _PopupMenuProc + Settings%
theWidth% = FN STRINGWIDTH(theName$)
IF theWidth% > 0 THEN theWidth% = theWidth% + 13
hControl& = FN NEWCONTROL(myWindow&,theRect&.top%,theName$,_True,0,MenuResID%,theWidth%,Settings%,IDtoUse% * 65536)
END IF
END FN
eg:
DIM myRect.8
CALL SETRECT(myRect,10,30,200,30+30)
FN PopupMenuButton("Font Size:",1,4000,@myRect,0)
... or something like that...
|