Discussion:
[Gambas-user] Form.Enabled = False
Matti
2010-09-09 19:22:03 UTC
Permalink
Gambas 3
Trying to show a modal window that has to be closed before other windows can do
anything.
"Fxy.ShowModal" is not useable, because the form should be placed somewhere and
not be centered relative to the desktop (why is a modal window centered and
can't be moved?)
So I tried to disable the underlying form FMain. I understand Enable = False as:
the form is inactive and doesn't accept any inputs. But I got funny results.
Most of the controls are inactive, some not.
See example.

Regards
Matti
Benoît Minisini
2010-09-12 20:15:22 UTC
Permalink
Post by Matti
Gambas 3
Trying to show a modal window that has to be closed before other windows
can do anything.
"Fxy.ShowModal" is not useable, because the form should be placed somewhere
and not be centered relative to the desktop (why is a modal window
centered and can't be moved?)
Because modal windows are dialog windows, and it's a common practice to always
center them on screen.
Post by Matti
So I tried to disable the underlying form FMain. I understand Enable =
False as: the form is inactive and doesn't accept any inputs. But I got
funny results. Most of the controls are inactive, some not.
See example.
Yes, it is not clearly explained on the wiki: native events, i.e. events
defined in the Control class (MouseUp, MouseDown, MouseMove, KeyPress,
KeyRelease, Enter, Leave...) are always raised, whatever the value of the
Enabled property.

Regards,
--
Benoît Minisini
Matti
2010-09-12 21:09:32 UTC
Permalink
But, what is the benefit of Enabled = False then?
If the control or window is only partly disabled, and the user can do a lot of
things with it?
Is there no property or method to "really" disable and don't allow the user to
do something?
Post by Benoît Minisini
Yes, it is not clearly explained on the wiki: native events, i.e. events
defined in the Control class (MouseUp, MouseDown, MouseMove, KeyPress,
KeyRelease, Enter, Leave...) are always raised, whatever the value of the
Enabled property.
Regards,
Benoît Minisini
2010-09-12 22:14:22 UTC
Permalink
Post by Matti
But, what is the benefit of Enabled = False then?
If the control or window is only partly disabled, and the user can do a lot
of things with it?
The user should not be able to do anything with it. You decide, as you
implement the event handler.

Native events are low level, lower than the Enabled property. But if a
disabled control raises a non-native event, it should be a bug!
--
Benoît Minisini
Matti
2010-09-12 22:40:27 UTC
Permalink
Sorry, I don't understand.
How can I "implement the event handler"?
Confused
Matti
Post by Benoît Minisini
Post by Matti
But, what is the benefit of Enabled = False then?
If the control or window is only partly disabled, and the user can do a lot
of things with it?
The user should not be able to do anything with it. You decide, as you
implement the event handler.
Native events are low level, lower than the Enabled property. But if a
disabled control raises a non-native event, it should be a bug!
Benoît Minisini
2010-09-16 10:53:55 UTC
Permalink
Post by Matti
Sorry, I don't understand.
How can I "implement the event handler"?
Confused
Matti
"implement the event handler" means that you wrote a "Public Sub
MyControl_Event()" function to handle an event. If you do not write an event
handler, the event is not sent.

Regards,
--
Benoît Minisini
Matti
2010-09-16 20:36:19 UTC
Permalink
Yes, of course. Sometimes I am stupid.
Post by Benoît Minisini
Post by Matti
Sorry, I don't understand.
How can I "implement the event handler"?
Confused
Matti
"implement the event handler" means that you wrote a "Public Sub
MyControl_Event()" function to handle an event. If you do not write an event
handler, the event is not sent.
Regards,
Loading...