Because origin one is set too strong&resctrictive (loosing control off a gad), IMHO,
I invest one hour to read sources and made some experiments.Third went to planned success.
Let me explain.
Now you can do selection of an item quickly, even if riding a mouse off the Miniselector gad,
but holding LMB.When leavin mousepress & mice is anywhere, nothing happens.Miniselector gad
remains opened.
LMB click on gad area means 'Select this item !', as usual.
LMB click off gad area means 'Ehh, not now, I'll do another mici/key/gad job.Close it! ( the miniselector gad)'
RMB click anywhere means 'CLOSE it !
Final changes in "Miniselector.bas" file
Code: Select all
#include once "ListBox.bas"
namespace sGUI
declare function MiniSelector(PosX as integer,PosY as integer,NumChars as integer, NumRows as integer, TOAddr as textobject ptr=0, EntrySelected as integer=0,DisplayMode as integer=0) as integer
function MiniSelector(posx as integer,posy as integer,NumChars as integer, NumRows as integer, TOAddr as textobject ptr=0, EntrySelected as integer=0,DisplayMode as integer=0) as integer
'... a few lines of code
'...
' and control loop ...
do
event->xSleep(1,1)
if event->GADGETMESSAGE then
select case event->GADGETMESSAGE
case list
function=GetListBoxVal(list)
event->EXITEVENT=1
end select
else
/'
'~~~~~~~~~~~~~~~~~~~~~~~~~ OLD code ~~~~~~~~~~~~~~~~~~
'orig code
if LMB=HOLD then
if (MOUSEX<posx) or (MOUSEX>posx+boxw-1) or (MOUSEY<posy) or (MOUSEY>posy+boxh-1) then
function=0
event->EXITEVENT=1
end if
end if
'~~~~~~~~~~~~~~~~~~~~~~~~~ OLD code ~~~~~~~~~~~~~~~~~~
'/
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'new code
if RMB=HIT then
function=0
event->EXITEVENT=1
end if
if LMB=HIT andalso ((MOUSEX<posx) or (MOUSEX>posx+boxw-1) or (MOUSEY<posy) or (MOUSEY>posy+boxh-1)) then
function=0
event->EXITEVENT=1
end if
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end if
loop until event->EXITEVENT
'... the rest of file
posted previously.
Last feature missing is displaying text item (LongestLine) in Miniselector gad longer then x-screensize,
with hidden&additional Hslider.But who wants it ? If somebody will write it, what an exciting moment !)
IMO, Combobox now is perfect & fit. Happy coding, enjoy it !