LiveCode Bug or my error

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

LiveCode Bug or my error

Post by JackieBlue » Tue Aug 05, 2014 4:33 am

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: LiveCode Bug or my error

Post by jmburnod » Tue Aug 05, 2014 8:35 am

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
https://alternatic.ch

JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

Re: LiveCode Bug or my error

Post by JackieBlue » Tue Aug 05, 2014 1:23 pm

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: LiveCode Bug or my error

Post by dunbarx » Tue Aug 05, 2014 1:51 pm

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: LiveCode Bug or my error

Post by jmburnod » Tue Aug 05, 2014 2:31 pm

Hi Craig,
Thanks for explanations. That is clearer for me
Jean-Marc
https://alternatic.ch

JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

Re: LiveCode Bug or my error

Post by JackieBlue » Tue Aug 05, 2014 3:41 pm

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!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: LiveCode Bug or my error

Post by dunbarx » Tue Aug 05, 2014 5:54 pm

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

JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

Re: LiveCode Bug or my error

Post by JackieBlue » Tue Aug 05, 2014 7:51 pm

Ok. How does one determine if it is user error? Someone else check it?

JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

Re: LiveCode Bug or my error

Post by JackieBlue » Tue Aug 05, 2014 11:01 pm

Same thing happens when using on closefield.

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: LiveCode Bug or my error

Post by SparkOut » Wed Aug 06, 2014 6:43 am

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)

JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

Re: LiveCode Bug or my error

Post by JackieBlue » Fri Aug 08, 2014 3:59 am

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)

Post Reply