Disabled or Hidden Control still has Focus

Discussions related to the LBB compiler and run-time engine
guest
Site Admin
Posts: 192
Joined: Tue Apr 03, 2018 1:34 pm

Re: Disabled or Hidden Control still has Focus

Post by guest »

JackKelly wrote: Tue Nov 19, 2019 10:35 pmThe stylebits suggestion doesn't change the peculiarity that I observed
It does when I try it. Here is your original demo program, modified solely by the inclusion of the STYLEBITS. Now pressing the space bar does not result in the button handler being called (the difference being that the button never acquires input focus in the first place):

Code: Select all

NoMainWin
StaticText #1.debug "debug line", 0, 0, 200, 25
Button #1.Button1 "Button1", CallSub, UL, 50, 60, 100, 50
Stylebits #1.Button1 _WS_DISABLED,0,0,0
open "Disable / Hide Demonstration" for window as #1
#1 "TrapClose [Quit]"
#1 "Font Ariel 12"

#1.Button1 "!Disable"
'#1.Button1 "!Hide"

wait

[Quit]
close #1: end

sub CallSub CallingHandle$
    #1.debug CallingHandle$
    call delay 1
    #1.debug ""
end sub

sub delay seconds
    timer seconds*1000, [delay]
    wait
[delay]
    timer 0
end sub
I am still firmly of the opinion that LBB should not try to override Windows' default, and documented, behavior - whether or not you think it is a "peculiarity".
User avatar
JackKelly
Posts: 63
Joined: Fri Apr 06, 2018 2:38 am
Location: Rome NY, USA

Re: Disabled or Hidden Control still has Focus

Post by JackKelly »

Thanks, Richard. I had the 'stylebits' line in the wrong place. You are 100% correct, in all respects.

Jack