Post by tsh73 on Jun 18, 2021 20:13:11 GMT
There was a thread on LB forum about marking some of many textbox entered by user (as invalid)
Here is (one of possible) no-API ways to do it
Just line up your textboxes,
put a graphicbox strip along it - and use it to draw any marks you wish!
Here is (one of possible) no-API ways to do it
Just line up your textboxes,
put a graphicbox strip along it - and use it to draw any marks you wish!
'try to mark selected textboxes
'no API solution
nomainwin
WindowWidth = 432
WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'sorry I cannot use variable. But I can pretend it is there, so i = 0 to 3 will get me coords
textbox #main.textbox1, 35, 15+0*40, 100, 25
textbox #main.textbox2, 35, 15+1*40, 100, 25
textbox #main.textbox3, 35, 15+2*40, 100, 25
textbox #main.textbox4, 35, 15+3*40, 100, 25
'thing to put marks onto.
'With LB, you could remove border with a stylebits command
'stylebits #main.gr5, 0,_WS_BORDER,0,0
graphicbox #main.gr5, 5, 15, 25, 3*(25+15)+25
button #main.button6, "Check for Odd", [buttonCheck], UL, 14, 176, 122, 25
button #main.button7, "Reset", [buttonReset], UL, 14, 220, 122, 25
statictext #main.statictext8, "log", 158, 11, 144, 20
texteditor #main.log, 150, 31, 264, 320
menu #main, "Edit" '<--- Texteditor Menu can be moved but not removed.
open "textbox check/highlight" for window as #main
print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
#main.gr5, "down; fill buttonface; color red; backcolor red; flush"
N=4 'number of textboxes. I am lazy so I left them textbox1,textbox2...
goto [buttonReset] 'will get to WAIT there
wait
[quit.main]
Close #main
END
[buttonCheck] 'check
#main.log time$()
for i = 1 to 4
hndl$="#main.textbox";i
#hndl$ "!contents? value"
'print i, value
if value mod 2 then
#main.log hndl$;" has odd number!"
#main.gr5, "place ";12;" ";10+(i-1)*40;";circlefilled 7"
end if
next
#main.gr5, "flush"
#main.log "-------------------"
wait
[buttonReset]
'new numbers
for i = 1 to 4
hndl$="#main.textbox";i
#hndl$ int(rnd(0)*10)
'default styles
#main.gr5, "fill buttonface; flush"
next
wait