
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 |
CONTROLS
Create invisible controls
Yes, this is easy. Just define a bunch of rectangles that equate to your buttons. So you dimension with :
DIM RectT,RectL,RectB,RectR
DIM MouseY,MouseX
(in this order !!) Then, when you get a mouse click, scan all the rectangles with :
Test = FN PTINRECT(MouseY,RectT)
If the Test is true, they've clicked in your (invisible) button. This also works well in the non-active window, and I use it to create buttons in palettes.
This may be a bit overkill, but I seem to be CDEF happy lately. You could make a CDEF that doesn't actually draw anything or even invert when clicked. Then you could handle an invisible button just like any other.
I'd be willing to make the CDEF for you. Such a thing would have almost no code!
I'd love to see that ;+)
Okay guys, here goes nothing. I typed it all out at home and tested it and then forgot to bring it to work to send, so I'm going to try it from memory. You may have to turn AUTOCLIP off. The button type is 161. Good luck and if it sucks, I'll mail the one that works.
'
'BUTTON 1,_activeWnd,"Find the Button",(0,0)-(30,30),161
'
'-------------
RESOURCES "","rsrcRSED","CDEF", 10, "InvisCDEF"
COMPILE 0,_caseInsensitive_DimmedVarsOnly_appendRes
END GLOBALS
OUTPUT FILE "InvisCDEF.res"
GOTO "CDEF_Entry"
'===========
'Param& is the pt clicked
'
CLEAR LOCAL
DIM c.8, clicked
LOCAL FN Clicked (cntl&, param&)
c;8 = [cntl&]+_cntrlRect
clicked = FN PTINRECT(param&,c)
END FN=clicked
'==========
'Create control region
'
CLEAR LOCAL
DIM c.8
LOCAL FN MakeRgn (cntl&, param&)
c;8 = [cntl&]+_cntrlRect
CALL OPENRGN
CALL FRAMERECT (c)
CALL CLOSERGN (param&)
END FN
"CDEF_Entry"
DIM varCode%,control&,msg%,parm&, hit&
ENTERPROC%(varCode%,control&,msg%,parm&)
hit& = _nil
SELECT msg%
CASE 1
hit&=FN Clicked(control&,parm&)
CASE 2,10
FN MakeRgn
END SELECT
EXITPROC%=hit&
|