Page 1 of 1

LiveCode Bug or my error

Posted: Tue Aug 05, 2014 4:33 am
by JackieBlue
Greetings. Using LiveCode Pro 6.7, dp7

Doing some simple programming. What I want to happen is that on exit of a field (or change of field) I want to check the entry of the field and display one of 2 message boxes (Answer). Eventually I will put code in that will perform the change I want to happen after checking the data but this seemed like a good way to start while I'm learning to code in LiveCode. Here is the code that is the field "txtSellingFeesPerc"

Code: Select all

on exitField
   if field "txtSellingFeesPerc" < 1 Then
   Answer "OK"
   Else 
      Answer "Fix IT"
      End If
end exitField

When I execute this, it will often work the first time. I will then go there, change it, and all the code executes properly, then immediately shuts down the entire LiveCode environment. Any suggestions?

Thanks. Jack

Re: LiveCode Bug or my error

Posted: Tue Aug 05, 2014 8:35 am
by jmburnod
Hi Jack,
I never used "exitField" :oops: and i'm not sure I really understand
"Sent to the field with the selection when the selection is being removed from the field, and its contents have not changed."
Some explanation are welcome

I get also a strange behavior with "exitField" (LC 5.5) :
The messagesBox follow the cursor and I can't choose the browse tool from the tool palette.

Maybe "CloseField" will do the job. I think "the value of" is useful when you have to work with numbers.
Something like that:

Code: Select all

on closefield
   if the value of field "txtSellingFeesPerc" < 1 Then
      Answer "OK"
   Else 
      Answer "Fix IT"
   End If
end closefield
Best regards
Jean-Marc

Re: LiveCode Bug or my error

Posted: Tue Aug 05, 2014 1:23 pm
by JackieBlue
Thank You Jean-Marc.

I will try your method. I am still learning LC so I explore a lot of events and the names are different than other languages.

Re: LiveCode Bug or my error

Posted: Tue Aug 05, 2014 1:51 pm
by dunbarx
Hi.

"ExitField" can be tricky, since it will fire even if a field gains focus, and then the user does anything else that causes that field to lose focus. This without actually clicking in the field, essentially "removing the selection" from that field. But it is just another message, and certainly has its uses, in that all changes to the environment need to be addressed in this way, with a message.

Craig Newman

Re: LiveCode Bug or my error

Posted: Tue Aug 05, 2014 2:31 pm
by jmburnod
Hi Craig,
Thanks for explanations. That is clearer for me
Jean-Marc

Re: LiveCode Bug or my error

Posted: Tue Aug 05, 2014 3:41 pm
by JackieBlue
Thanks Craig. It is still a bug, I wanted it to fire everytime you exit as I was going to put check code in it. I will try some alternatives in a bit and then see about reporting it as a bug. Firing an event and putting up a message box should not kill the environment!

Re: LiveCode Bug or my error

Posted: Tue Aug 05, 2014 5:54 pm
by dunbarx
Firing an event and putting up a message box should not kill the environment!
I agree.

I would not file a bug report until we have examined this further. If the issue is an unstable or intermittent problem, then certainly. But we should make sure it is not operator malfunction. With me, it invariably is just that.

Craig

Re: LiveCode Bug or my error

Posted: Tue Aug 05, 2014 7:51 pm
by JackieBlue
Ok. How does one determine if it is user error? Someone else check it?

Re: LiveCode Bug or my error

Posted: Tue Aug 05, 2014 11:01 pm
by JackieBlue
Same thing happens when using on closefield.

Re: LiveCode Bug or my error

Posted: Wed Aug 06, 2014 6:43 am
by SparkOut
Hmmm...
the value might be trying to resolve something the engine doesn't like?
Try
if field "txtSellingFeesPerc" < 1 then...
Does that crash? (it may still give errors but hopefully not die)

Re: LiveCode Bug or my error

Posted: Fri Aug 08, 2014 3:59 am
by JackieBlue
Nope. Same thing on this syntax. For now, I'm going to remove the offending code and just write some data check routines in the calculation piece rather than when the entry is completed. Very weird.
SparkOut wrote:Hmmm...
the value might be trying to resolve something the engine doesn't like?
Try
if field "txtSellingFeesPerc" < 1 then...
Does that crash? (it may still give errors but hopefully not die)