Page 2 of 2

Re: Disabled or Hidden Control still has Focus

Posted: Wed Nov 20, 2019 2:59 am
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".

Re: Disabled or Hidden Control still has Focus

Posted: Wed Nov 20, 2019 12:33 pm
by JackKelly
Thanks, Richard. I had the 'stylebits' line in the wrong place. You are 100% correct, in all respects.

Jack