Home > Archive > Clarion > November 2005 > Enabling/Disabling a button based on entry
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Enabling/Disabling a button based on entry
|
|
|
| The idea is to disable a button until an entry field has a specific
entry. This has been the biggest trouble I've had so far in Clarion,
because I can't manage to disable a button easily, even if it has
disable in it's properties(stays enabled regardless). It is so much
easier in say VB to do this very simple procedure, but it's a nightmare
to even figure out how to disable the button in Clarion, let alone keep
it disabled based on a condition.
The basics of it is as such:
If password = 'Password1' OR 'Password2' THEN ENABLE(?OkButton).
The OkButton calls the procedure which has a browse filter based on
which password they put in. It's a quick and dirty way of making a
filter based on who is viewing it without the user even realizing it.
The passwords work fine, the filter works, but I can't keep the
OkButton disabled as long as the entry does not match any accepted
password.
I've gone through pages and pages of topics here but none have answered
this question. I'm sure it's something overly simple that I just
haven't figured out yet. It's completely cosmetic, sure, and I have it
set so the browse doesn't come up if the password doesn't match, but
I'd prefer it this way.
You know, for an IDE that is supposed to simplify things, it really
makes the simple things harder...
| |
| HarleyMan 2005-11-15, 6:55 pm |
| I do this all the time but use hide/unhide.... what results are you
getting with enable/disable???
Harleyman
| |
|
|
HarleyMan wrote:
> I do this all the time but use hide/unhide.... what results are you
> getting with enable/disable???
>
> Harleyman
Depending on my method, 9 times out of 10 the button just doesn't
disable. The only 2 methods I've found that will have it disabled at
runtime don't work because in one method it re-enables after less than
a second and the other re-enables after I tab out of the entry field,
no matter what is in the field.
Setting a timer to check the field didn't seem to work, as it enables
the button once the timer is triggered, regardless of what is in the
entry. I'm at a loss here. If setting disable on a button doesn't work,
why have the option?!?!
| |
| HarleyMan 2005-11-15, 6:55 pm |
| hide/unhide/enable/disable all work on buttons - hide/unhide make a
button total invisable.... enable/disable grey the button.... BUT your
situation sounds more like control logic problems - ie: you have the
enable/disable logice in the wrong place (possible why it gets re-set
immediately or in a second or two)... I code everything manually so
don't know much about methods and all that.... have you placed you code
inside
accept
update
case accepted()
of ?buttonname
if you don't have a case accepted (there are a couple of way to code
this but resutls are the same) you will get un-pridictable results....
Harleyman
| |
|
|
HarleyMan wrote:
> hide/unhide/enable/disable all work on buttons - hide/unhide make a
> button total invisable.... enable/disable grey the button.... BUT your
> situation sounds more like control logic problems - ie: you have the
> enable/disable logice in the wrong place
Even if I insert ZERO code to do this, it is still enabled at runtime.
The control is disabled in the design, and I checked the source for any
enable events, there aren't any. By all reasoning it should never
enable, but it does. I've never figured this thing out, seems to be a
problem with Clarion itself. Nothing in the source triggers the enable,
I set it to disable, it is still enabled. It's baffling.
| |
| Leonid Chudakov 2005-11-15, 9:55 pm |
| Do a search in code for ?OKButton
probably somewhere it code it's getting enabled
--
--
Leonid Chudakov
chudakov@klarisoft.com
Cool tools and Clarion examples at
http://www.klarisoft.com
"Malak" <jerubbaal@gmail.com> wrote in message
news:1132094052.207822.298110@g44g2000cwa.googlegroups.com...
>
> HarleyMan wrote:
>
> Even if I insert ZERO code to do this, it is still enabled at runtime.
> The control is disabled in the design, and I checked the source for any
> enable events, there aren't any. By all reasoning it should never
> enable, but it does. I've never figured this thing out, seems to be a
> problem with Clarion itself. Nothing in the source triggers the enable,
> I set it to disable, it is still enabled. It's baffling.
>
| |
|
| Well I'm going to give up on this. It was cosmetic only for this
particular application, although I've had the same trouble in several
programs I've worked on. It just doesn't make any sense to have a
disable property that doesn't function, and there's nowhere in the
source that even enables the button...
| |
| Jim in AZ 2005-11-19, 6:55 pm |
| Hi Malak,
Put in the Open Window embed:
Disable(?OK)
and in the Accepted embed point for the password entry field (before generated
code), add:
If UserIDEntered = 'password1'
Enable(?OK)
Else
Disable(?OK)
End
je
"Malak" <jerubbaal@gmail.com> wrote in message
news:1132086387.671554.258960@g44g2000cwa.googlegroups.com...
> The idea is to disable a button until an entry field has a specific
> entry. This has been the biggest trouble I've had so far in Clarion,
> because I can't manage to disable a button easily, even if it has
> disable in it's properties(stays enabled regardless). It is so much
> easier in say VB to do this very simple procedure, but it's a nightmare
> to even figure out how to disable the button in Clarion, let alone keep
> it disabled based on a condition.
>
> The basics of it is as such:
>
> If password = 'Password1' OR 'Password2' THEN ENABLE(?OkButton).
>
> The OkButton calls the procedure which has a browse filter based on
> which password they put in. It's a quick and dirty way of making a
> filter based on who is viewing it without the user even realizing it.
> The passwords work fine, the filter works, but I can't keep the
> OkButton disabled as long as the entry does not match any accepted
> password.
>
> I've gone through pages and pages of topics here but none have answered
> this question. I'm sure it's something overly simple that I just
> haven't figured out yet. It's completely cosmetic, sure, and I have it
> set so the browse doesn't come up if the password doesn't match, but
> I'd prefer it this way.
>
> You know, for an IDE that is supposed to simplify things, it really
> makes the simple things harder...
>
|
|
|
|
|