Liberty BASIC Community Forum
« GROUPBOX enable/disable »

Welcome Guest. Please Login or Register.
Nov 20th, 2017, 05:57am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: GROUPBOX enable/disable  (Read 117 times)
tsh73
Board Moderator

member is offline

Avatar

Anatoly (real name)


PM

Gender: Male
Posts: 1686
xx GROUPBOX enable/disable
« Thread started on: Nov 13th, 2017, 07:51am »

Hello everybody

I just noticed GROUPBOX has
!disable
!enable
commands.

The question is: does they do anything at all?
Sample program enables/disables first groupbox.
I see nothing changed.

Am I missing something?

Code:
'   Form created with the help of Freeform-J v.261006
'   Generated on Nov 13, 2017 at 16:45:09

    nomainwin

    WindowWidth = 550
    WindowHeight = 410

    UpperLeftX=int((DisplayWidth-WindowWidth)/2)
    UpperLeftY=int((DisplayHeight-WindowHeight)/2)

    groupbox #main.groupbox1, "GroupBox Caption", 26, 16, 208, 176
    groupbox #main.groupbox3, "GroupBox Caption", 26, 195, 203, 161
    radiobutton #main.radiobutton4, "RadioButton Caption", [radiobutton4Set], [radiobutton4Reset], 37, 43, 168, 20
    radiobutton #main.radiobutton5, "RadioButton Caption", [radiobutton5Set], [radiobutton5Reset], 38, 67, 168, 20
    radiobutton #main.radiobutton6, "RadioButton Caption", [radiobutton6Set], [radiobutton6Reset], 40, 226, 168, 20
    radiobutton #main.radiobutton7, "RadioButton Caption", [radiobutton7Set], [radiobutton7Reset], 39, 247, 168, 20
    button #main.button8, "enable", [button8Click], UL, 317, 27, 122, 25
    button #main.button9, "disable", [button9Click], UL, 317, 74, 122, 25
    open "untitled" for window as #main
    print #main, "trapclose [quit.main]"

    print #main, "font ms_sans_serif 10"

    wait

[quit.main]
    Close #main
    END


[radiobutton4Set]    'Perform action for the radiobutton named 'radiobutton4'
    'Insert your own code here
    wait


[radiobutton4Reset]    'Perform reset for the radiobutton named 'radiobutton4'
    'Insert your own code here
    wait


[radiobutton5Set]    'Perform action for the radiobutton named 'radiobutton5'
    'Insert your own code here
    wait


[radiobutton5Reset]    'Perform reset for the radiobutton named 'radiobutton5'
    'Insert your own code here
    wait


[radiobutton6Set]    'Perform action for the radiobutton named 'radiobutton6'
    'Insert your own code here
    wait


[radiobutton6Reset]    'Perform reset for the radiobutton named 'radiobutton6'
    'Insert your own code here
    wait


[radiobutton7Set]    'Perform action for the radiobutton named 'radiobutton7'
    'Insert your own code here
    wait


[radiobutton7Reset]    'Perform reset for the radiobutton named 'radiobutton7'
    'Insert your own code here
    wait


[button8Click]    'Perform action for the button named 'button8'
     #main.groupbox1 "enabled"
     #main.groupbox1 "!enable"
    wait


[button9Click]    'Perform action for the button named 'button9'
     #main.groupbox1 "disabled"
     #main.groupbox1 "!disable"
    wait
 
User IP Logged

damned Dog in the Manger
Brandon Parker
Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1118
xx Re: GROUPBOX enable/disable
« Reply #1 on: Nov 14th, 2017, 7:06pm »

Anatoly,
It doesn't look like it does anything, but it looks like it might not be a Liberty BASIC thing. Run the code below and see what you get with the EnableWindow function. The function is returning appropriate values for what it is used for, but it does not appear to change anything; just like the Liberty BASIC command.

That being said, since the Windows GroupBox cannot be selected, it has no check state, focus state, or push state I'm not certain what anyone would expect when a GroupBox is "Enabled" or "Disabled".

Code:
'   Form created with the help of Freeform-J v.261006
'   Generated on Nov 13, 2017 at 16:45:09

    nomainwin

    WindowWidth = 550
    WindowHeight = 410

    UpperLeftX=int((DisplayWidth-WindowWidth)/2)
    UpperLeftY=int((DisplayHeight-WindowHeight)/2)

    groupbox #main.groupbox1, "GroupBox Caption", 26, 16, 208, 176
    groupbox #main.groupbox3, "GroupBox Caption", 26, 195, 203, 161
    radiobutton #main.radiobutton4, "RadioButton Caption", [radiobutton4Set], [radiobutton4Reset], 37, 43, 168, 20
    radiobutton #main.radiobutton5, "RadioButton Caption", [radiobutton5Set], [radiobutton5Reset], 38, 67, 168, 20
    radiobutton #main.radiobutton6, "RadioButton Caption", [radiobutton6Set], [radiobutton6Reset], 40, 226, 168, 20
    radiobutton #main.radiobutton7, "RadioButton Caption", [radiobutton7Set], [radiobutton7Reset], 39, 247, 168, 20
    button #main.button8, "enable", [button8Click], UL, 317, 27, 122, 25
    button #main.button9, "disable", [button9Click], UL, 317, 74, 122, 25
    open "untitled" for window as #main
    print #main, "trapclose [quit.main]"

    print #main, "font ms_sans_serif 10"

    wait

[quit.main]
    Close #main
    END


[radiobutton4Set]    'Perform action for the radiobutton named 'radiobutton4'
    'Insert your own code here
    wait


[radiobutton4Reset]    'Perform reset for the radiobutton named 'radiobutton4'
    'Insert your own code here
    wait


[radiobutton5Set]    'Perform action for the radiobutton named 'radiobutton5'
    'Insert your own code here
    wait


[radiobutton5Reset]    'Perform reset for the radiobutton named 'radiobutton5'
    'Insert your own code here
    wait


[radiobutton6Set]    'Perform action for the radiobutton named 'radiobutton6'
    'Insert your own code here
    wait


[radiobutton6Reset]    'Perform reset for the radiobutton named 'radiobutton6'
    'Insert your own code here
    wait


[radiobutton7Set]    'Perform action for the radiobutton named 'radiobutton7'
    'Insert your own code here
    wait


[radiobutton7Reset]    'Perform reset for the radiobutton named 'radiobutton7'
    'Insert your own code here
    wait


[button8Click]    'Perform action for the button named 'button8'
     #main.groupbox1 "enabled"
     #main.groupbox1 "!enable"
    wait


[button9Click]    'Perform action for the button named 'button9'
     #main.groupbox1 "disabled"
     '#main.groupbox1 "!disable"
     Notice EnableWindow(Hwnd(#main.groupbox1), 0)
     #main.groupbox1 "Didn't Update Text"
    wait


Function EnableWindow(hWnd, bEnable)
    CallDLL #user32, "EnableWindow", hWnd           As long, _
                                     bEnable        As long, _
                                     EnableWindow   As long
End Function 



{:0)

Brandon Parker
« Last Edit: Nov 14th, 2017, 7:07pm by Brandon Parker » User IP Logged

Windows 7 Home Premium 64-bit Intel(R) Quad Core(TM) i5 CPU M 430 @ 2.27GHz 4GB DDR3 RAM
tsh73
Board Moderator

member is offline

Avatar

Anatoly (real name)


PM

Gender: Male
Posts: 1686
xx Re: GROUPBOX enable/disable
« Reply #2 on: Nov 15th, 2017, 01:44am »

Well, in Visual Studio groupbox is a container
and disabling it disables all things it contains.
(checked on c#. It might be not aplicable I'm afraid)
EDIT MSDN says same for Visula C++, but that's NET.
Control::Enabled Property
says in Examples
Quote:
Lastly, it disables the group box by setting the Enabled property to false, which causes all controls contained within the group box to be disabled.

There might be difference down to API - but I don't go that low

If command does not do a thing then why there is such a command?
« Last Edit: Nov 15th, 2017, 01:59am by tsh73 » User IP Logged

damned Dog in the Manger
Rod
Global Moderator
ImageImageImageImageImage


member is online

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5562
xx Re: GROUPBOX enable/disable
« Reply #3 on: Nov 15th, 2017, 04:23am »

MSDN has conflicting advice. It seems that currently groupboxes are discouraged. They now also say all controls should be disabled in a groupbox rather than disabling the groupbox.

Quote:
Don't disable group boxes. To indicate that a group of controls doesn't currently apply, disable all the controls within the group box, but not the group box itself. This approach is more accessible and can be supported consistently by all UI frameworks.


https://msdn.microsoft.com/en-gb/library/windows/desktop/dn742405(v=vs.85).aspx

Like Anatoly, I would have expected the controls within a groupbox to be disabled if the groupbox was disabled.

Since this conflicts with current advice we could probably spend time on other things.
« Last Edit: Nov 15th, 2017, 05:13am by Rod » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls