ernie
New Member
Posts: 44
|
Post by ernie on Feb 16, 2020 22:27:30 GMT -5
In the attached file, in tab 1 graphic box #tab1.gb01 in a popup has a button labelled "PD" beneath it. Press the button and the text in the box becomes darker. When you then press keys "1" or "2" it is meant to register different characters in the box (a checkbox list). It works fine, just not in a popup, unless the user left-clicks on the box (after pushing the button) to manually focus. is this a parent issue - ? please help. Thank you. Attachments:42 sample.bas (25.19 KB)
|
|
|
Post by Chris Iverson on Feb 16, 2020 23:38:31 GMT -5
It's a focus issue. By clicking the button, you've set the input focus on the button.
I see you try to fix that, by issuing the "setfocus" command to the graphicbox, but I think sometimes that doesn't work properly with other controls on the window.
When I added this code after the "setfocus" command being issued to that graphicbox, it seems to work.
hGB01 = hwnd(#tab1.gb01) CallDLL #user32, "SetFocus",_ hGB01 as ulong,_ ret as ulong
|
|
ernie
New Member
Posts: 44
|
Post by ernie on Feb 16, 2020 23:54:06 GMT -5
WoW! Just what I was looking for. Thanks 1,000,000 Chris. Problem solved.
|
|
|
Post by Rod on Feb 17, 2020 15:14:17 GMT -5
I see a couple of things to think about. Setfocus normally works fine, don't know whats going on there, not sure it knows what window is on top and I have to right click to get it to respond. But Chris's fix pulls it all back together.
InKey$ is a system variable filled by the system and Global. Normal would be key$=InKey$ and key$="".
Flush uses memory, you need to CLS or delete flushed segments at some point, else the system will crash (if it runs for long enough, if your not looping and re drawing constantly it probably does not matter). A graphicbox CLS on window change would probably keep things clean.
Finally a background Timer does not interact well with Subs. As you have it the Subs are lean and mean and perhaps not called when the timer is running. So you just need to be aware.
|
|