Button Enabled attribute
Moderator: Rathinagiri
Button Enabled attribute
Hello Forum
Is there a way to set one of several buttons in a window to be disabled
when its window is first loaded / activated.?
You can set one button Invisible, but how about visible but not active until later logic sets it
enabled:=.T.
Thanks
Is there a way to set one of several buttons in a window to be disabled
when its window is first loaded / activated.?
You can set one button Invisible, but how about visible but not active until later logic sets it
enabled:=.T.
Thanks
-
- Posts: 388
- Joined: Wed Nov 21, 2012 7:14 pm
- Location: México
Re: Button Enabled attribute
Hi bluebird,
I do not understand...
Do you want to play with the visible, invisible, enabled and disabled?
Explicate better Please.
regards
I do not understand...
Do you want to play with the visible, invisible, enabled and disabled?
Explicate better Please.
regards
Last edited by Leopoldo Blancas on Thu Apr 04, 2019 3:33 am, edited 1 time in total.
-
- Posts: 388
- Joined: Wed Nov 21, 2012 7:14 pm
- Location: México
Re: Button Enabled attribute
I think you have the confusion of the terms, VISIBLE means that you can see the control in the form. VISIBLE: = .T.
If you do not want to see it then VISIBLE: =. F.
If you want it ACTIVE Enabled: =. T.
Do not remove it active Enabled: =. F.
These two properties are independent of each other, so you can have a button with:
VISIBLE: = .T.
Enabled: =. T.
or another button with:
VISIBLE: = .F.
Enabled: =. T.
Or any combination.
Now with the programming that you want to manage you can change those properties at any time.
Enviar comentarios
Historial
Guardadas
Comunidad
If you do not want to see it then VISIBLE: =. F.
If you want it ACTIVE Enabled: =. T.
Do not remove it active Enabled: =. F.
These two properties are independent of each other, so you can have a button with:
VISIBLE: = .T.
Enabled: =. T.
or another button with:
VISIBLE: = .F.
Enabled: =. T.
Or any combination.
Now with the programming that you want to manage you can change those properties at any time.
Enviar comentarios
Historial
Guardadas
Comunidad
Re: Button Enabled attribute
Thanks for your reading my entry - no I am not confused between Enabled and Visible.
With a button you can set VISIBLE .T. or .F. but I did not succeed with Enabled .T. which gave a syntax error.
I want the window hosting the buttons to appear with 3 enabled visible buttons and one visible but not enabled.
It will be enabled later when conditions permit.
Can a button appear disabled when the window is first activated?
Hope this clarifies my problem fellows
With a button you can set VISIBLE .T. or .F. but I did not succeed with Enabled .T. which gave a syntax error.
I want the window hosting the buttons to appear with 3 enabled visible buttons and one visible but not enabled.
It will be enabled later when conditions permit.
Can a button appear disabled when the window is first activated?
Hope this clarifies my problem fellows
Re: Button Enabled attribute
Code: Select all
#include "hmg.ch"
Function Main()
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 200 ;
HEIGHT 230 ;
MAIN
@ 0,70 BUTTON Button_1 CAPTION "door" WIDTH 50 HEIGHT 50 ACTION Nil
@ 70,70 BUTTON Button_2 CAPTION "window" WIDTH 50 HEIGHT 50 ACTION Nil
@ 140,70 BUTTON Button_3 CAPTION "disabled" WIDTH 50 HEIGHT 50 ACTION Nil
Form_1.Button_3.Enabled := .F.
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
-
- Posts: 388
- Joined: Wed Nov 21, 2012 7:14 pm
- Location: México
Re: Button Enabled attribute
Hello edk,
Well, I did not understand what my friend BLEUBIRD wanted, just an observation, if you allow me, it is not advisable to put sentences like
Form_1.Button_3.Enabled: = .F. between DEFINE WINDOWS and END WINDOWS, it is better to put ON INIT in DEFINE WINDOWS and there you put a Function or a Procedures or sentences IF THEY ARE FEW.
It would be something like this:
------------------------------------------------------------------------------------------------------------------------------------------------
Hola edk,
Bien, no entendí lo que quería mi amigo BLEUBIRD, solo una observación, si me lo permites, no es aconsejable poner sentencias como
Form_1.Button_3.Enabled := .F. entre DEFINE WINDOWS y END WINDOWS, es mejor poner ON INIT en DEFINE WINDOWS y ahí pones una Función o un Procedimeinto o sentencias SI SON POCAS.
Quedaria algo así:
Saludos
Well, I did not understand what my friend BLEUBIRD wanted, just an observation, if you allow me, it is not advisable to put sentences like
Form_1.Button_3.Enabled: = .F. between DEFINE WINDOWS and END WINDOWS, it is better to put ON INIT in DEFINE WINDOWS and there you put a Function or a Procedures or sentences IF THEY ARE FEW.
It would be something like this:
------------------------------------------------------------------------------------------------------------------------------------------------
Hola edk,
Bien, no entendí lo que quería mi amigo BLEUBIRD, solo una observación, si me lo permites, no es aconsejable poner sentencias como
Form_1.Button_3.Enabled := .F. entre DEFINE WINDOWS y END WINDOWS, es mejor poner ON INIT en DEFINE WINDOWS y ahí pones una Función o un Procedimeinto o sentencias SI SON POCAS.
Quedaria algo así:
Code: Select all
#include "hmg.ch"
Function Main()
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 200 ;
HEIGHT 230 ;
MAIN;
ON INIT Form_1.Button_3.Enabled := .F.
@ 0,70 BUTTON Button_1 CAPTION "door" WIDTH 50 HEIGHT 50 ACTION Nil
@ 70,70 BUTTON Button_2 CAPTION "window" WIDTH 50 HEIGHT 50 ACTION Nil
@ 140,70 BUTTON Button_3 CAPTION "disabled" WIDTH 50 HEIGHT 50 ACTION Nil
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
Re: Button Enabled attribute
Hi Leopoldo Blancas.Leopoldo Blancas wrote: ↑Fri Apr 05, 2019 1:28 am Hello edk,
Well, I did not understand what my friend BLEUBIRD wanted, just an observation, if you allow me, it is not advisable to put sentences like
Form_1.Button_3.Enabled: = .F. between DEFINE WINDOWS and END WINDOWS, it is better to put ON INIT in DEFINE WINDOWS and there you put a Function or a Procedures or sentences IF THEY ARE FEW.
I ask with curiosity: not advisable? For what reason?
I always do this when I want to define the initial state of the form and controls and I have never noticed that there are any problems with this.
This must be done in the proper order of defining the form items, of course.
The method you indicate is the most correct, but personally I prefer my own - the code is more readable to me.
Edk.
-
- Posts: 388
- Joined: Wed Nov 21, 2012 7:14 pm
- Location: México
Re: Button Enabled attribute
Good Friend, everyone has his style of programming !!!edk wrote: ↑Fri Apr 05, 2019 6:51 amHi Leopoldo Blancas.Leopoldo Blancas wrote: ↑Fri Apr 05, 2019 1:28 am Hello edk,
Well, I did not understand what my friend BLEUBIRD wanted, just an observation, if you allow me, it is not advisable to put sentences like
Form_1.Button_3.Enabled: = .F. between DEFINE WINDOWS and END WINDOWS, it is better to put ON INIT in DEFINE WINDOWS and there you put a Function or a Procedures or sentences IF THEY ARE FEW.
I ask with curiosity: not advisable? For what reason?
I always do this when I want to define the initial state of the form and controls and I have never noticed that there are any problems with this.
This must be done in the proper order of defining the form items, of course.
The method you indicate is the most correct, but personally I prefer my own - the code is more readable to me.
Edk.
Greetings.