curly
Full Member
Posts: 161
|
Post by curly on Apr 30, 2021 7:11:46 GMT -5
Hi again, can't get this to work. I've tried the stylebits line before and after the textboxes were defined, but I understand it doesn't matter where stylebits is used as long as it is before the window is opened?. Clearly doing something wrong? Compiles fine but numbers still appear in the textbox as I type?
statictext #home.stpw1, "Enter Pin", 20, row(7), 85, 20 textbox #home.tbpw1, 110, row(7),150,20 stylebits #home.tbpw1, 0, _ES_PASSWORD, 0, 0 statictext #home.stpw2, "Repeat Pin", 20, row(8), 85, 20 stylebits #home.tbpw2, 0, _ES_PASSWORD, 0, 0 textbox #home.tbpw2, 110, row(8),150,20
|
|
|
Post by Walt Decker on Apr 30, 2021 8:07:10 GMT -5
stylebits #home.tbpw1, _ES_PASSWORD, 0, 0, 0
|
|
curly
Full Member
Posts: 161
|
Post by curly on May 1, 2021 3:29:53 GMT -5
Hi Walt,thanks for your very quick assist, but I still can't get it working like I think itshould? I assume that someone types their pin in the textbox, but each character typed should appear in the textbox as a *? If that is the case, and if I can get it working, then can I read the contents that were typed in the normal way? i.e. #home.tbpw1,"!contents? temp$"
|
|
|
Post by tsh73 on May 1, 2021 4:54:11 GMT -5
Help on a stylebits has an example of _ES_PASSWORD
so
'Form created with the help of Freeform 3 v07-15-08 'Generated on May 01, 2021 at 13:43:44
[setup.main.Window]
'-----Begin code for #main
nomainwin WindowWidth = 265 WindowHeight = 160 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'-----Begin GUI objects code
TextboxColor$ = "white" 'SIMPLE THING DOES NOT WORK ' stylebits #main.textbox1, _ES_PASSWORD, 0, 0, 0 'EXAMPLE STRING FROM HELP FILE ON STYLEBITS - DOES stylebits #main.textbox1, _ES_PASSWORD, _ES_AUTOVSCROLL or _ES_MULTILINE, 0, 0 textbox #main.textbox1, 35, 27, 100, 25 textbox #main.textbox2, 35, 87, 100, 25 statictext #main.statictext4, "Enter password here", 5, 5, 127, 20 statictext #main.statictext5, "so we are getting", 5, 57, 101, 20
'-----End GUI objects code
open "password sylebit" for window as #main print #main, "font ms_sans_serif 10" print #main, "trapclose [quit.main]"
#main.textbox1 "!setfocus"
timer 200, [tick]
'[main.inputLoop] 'wait here for input event wait
[tick] #main.textbox1 "!contents? a$" #main.textbox2 a$ wait
[quit.main] 'End the program timer 0 close #main end
|
|
curly
Full Member
Posts: 161
|
Post by curly on May 2, 2021 6:38:13 GMT -5
Hi tsh73 (I would feel much more comfortable if you had a name?)
Thank you again so much, I also now see how the timer works, very clever!
|
|
|
Post by Rod on May 2, 2021 10:42:07 GMT -5
Well you are luck Anatoly answered and not John. Rod isn’t my usual name either, it’s “Stupid....” or “Honestly!”
|
|
curly
Full Member
Posts: 161
|
Post by curly on May 3, 2021 6:18:14 GMT -5
Hi, whatever you are all called,
Feeling quite chuffed (UK term for being pleased with myself!). Happy with attached that I can utilise into my program, but it is not perfect - I can't get the curser to flash in the other textbox? It clearly has focus when you click into it, as text can be added. Any suggestions please, (and I won't be offended by criticism)
In case you forget to look, the target pin is 1234
David ForegroundColor$ = "Black" BackgroundColor$ = "Buttonface" TexteditorColor$ = "White" TextboxColor$ = "White" NoMainWin WindowWidth = 1000 : WindowHeight = 500 UpperLeftX = Int((DisplayWidth-WindowWidth)/2) UpperLeftY = Int((DisplayHeight-WindowHeight)/2)
statictext #home.stpw1, "Enter Pin", 20, 100, 85, 20 stylebits #home.tbpw1, _ES_PASSWORD, _ES_AUTOVSCROLL or _ES_MULTILINE, 0, 0 textbox #home.tbpw1, 110, 100,150,20 statictext #home.stpw2, "Other randon data", 20, 130, 85, 20 stylebits #home.tbpw2, _ES_PASSWORD, 0, 0, 0 textbox #home.tbpw2, 110, 130,150,20 textbox #home.tb3, 110, 160, 150, 20
Open "Home" For Window As #home
#home "trapclose [quit]" #home "font ms_sans_serif 10"
pin$ = "1234" [OnePin]
pwtb1 = hWnd(#home.tbpw1) 'target textbox for entering pin - 'handle' is the Windows reference to the target textbox timer 100, [Seekpwtb1] 'check every 100mS to see if pin textbox has focus wait [Seekpwtb1] CallDLL #user32, "GetFocus", handle As long print #home.tbpw1, "!setfocus" if pwtb1 = handle then [SeekPin1] wait [SeekPin1] timer 0 timer 100, [GetPin1] wait [GetPin1] CallDLL #user32, "GetFocus", handle As long if pwtb1 <> handle then [OnePin] 'check focus remains on pin textbox #home.tbpw1 "!contents? pw1$" if len(pw1$)>3 then print #home.tbpw1, "!disable" goto [DonePin1] end if wait [DonePin1] timer 0 print #home.tb3, pw1$ if pw1$ <> pin$ then print #home.tbpw1, "" print #home.tbpw1, "!enable" notice "Wrong pin!" goto [OnePin] end if notice "Happy Days, found pin ";pw1$ timer 0 print #home.tbpw2, "!setfocus" wait
[quit] Close #home End
|
|
|
Post by tsh73 on May 3, 2021 8:17:01 GMT -5
try to make textbox higher, for starters set 30 then decrease till cursor still visible.
|
|
curly
Full Member
Posts: 161
|
Post by curly on May 3, 2021 14:29:51 GMT -5
Hi Anatoly, Please, no curved balls! - I haven't a clue what you mean? ? I don't know what you mean by making the textbox higher? Setting to 30, do you mean the timer? I thought I had cancelled the timer before setting focus to the textbox? (timer 0) ps I've never heard of the name Anatoly - is that a traditional American name? It sounds female to me for some reason? Kind regards, (Old timer,) David (miles away in UK - too oldto be looking for pick-up!)
|
|
|
Post by tsh73 on May 3, 2021 14:50:20 GMT -5
In this line, textbox #home.tbpw2, 110, 130,150,20 "20" is textbox height in pixels. I remember from some forum post long ago that if this space is too small, you do not have cursor in that textbox. On my machine, I do not have the cursor So try and change it to textbox #home.tbpw2, 110, 130,150,30 - it helped in my case. If you will get the cursor, that should mean that was indeed the problem (and you can make it smaller for cursor still showing) As for name en.wikipedia.org/wiki/AnatolySo, from Russia, with bears.
|
|
curly
Full Member
Posts: 161
|
Post by curly on May 4, 2021 4:42:28 GMT -5
Hi tsh73, amazing, with a box height of 21, no curser, increase to 22+ and curser appears.
Thank you very much,
|
|