Problem with Editable Fields

David Burgun dburgun at dsl.pipex.com
Mon Jul 18 13:50:11 EDT 2005


Hi,

Tried what you suggested, the invalid values still gets saved. I know 
the closeField gets called because I hear the beep. I put a 
breakpoint on both all three handler, mouseUp, NewMouseUp and 
closeField and when the done key is pressed it enters the mouseUp 
handler BEFORE closeField, so the old value gets saved. It pot luck 
if the closeField function gets called at all in the case, I am guess 
that it depends on timing, if the script gets run before the close 
stack command is issued.

This really is silly, what I want to do is so straight forward, I 
just cannot understand why it is so difficult in RunRev? Am I missing 
something or is it impossible to range check a field without jumping 
thru hoops?

Thanks a lot
Dave

>You can also try this in the "done" button:
>
>On MouseUp
>   Send DoThisScript to me in 0 seconds
>End MouseUp
>
>Then put the original mouseup script into a DoThisScript handler in 
>the button. This will ensure that the script runs after other 
>handlers.
>
>However, it seems odd that mouseup would be occuring before 
>closefield. Is it possible that your "done" button is non-focusing? 
>This would mean that when you press the button, the focus never 
>leaves the field you were in, thus not sending a closefield message. 
>If this is the case, you need to make sure your button is focusable.
>
>-----Original Message-----
>From: use-revolution-bounces at lists.runrev.com 
>[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Eric 
>Chatonet
>Sent: Monday, July 18, 2005 11:42 AM
>To: How to use Revolution
>Subject: Re: Problem with Editable Fields
>
>Hi Dave,
>
>May be another approach, more ergonomic, could help you:
>Just allow numbers to be typed into your field with a generic handler 
>like the following:
>
>on keyDown pKey
>    if pKey is an integer and the number of chars of target < 3 then 
>pass keyDown
>end keyDown
>
>It's only to get you started: you will find you have probably to 
>build a rawKeyDown handler to be more precise and manage the current 
>selection (if the user selects a portion and wants to type in).
>
>Best Regards from Paris,
>
>Eric Chatonet.
>
>Le 18 juil. 05 à 17:32, David Burgun a écrit :
>
>>  I have the a number of fields in a card that have to be range 
>>  checked, to do this i have the following code:
>>
>>  on openField
>>  set the cpSaveTextOfMe to the text of me
>>  end openField
>>
>>  on closeField
>>  if (the text of me < 0) or (the text of me > 999) then
>>    set the text of me to the cpSaveTextOfMe of me
>>    select the text of me
>>    beep
>>  end closeField
>>
>>
>>  There is also a "Done" Button that has this script:
>>
>>  on mouseUp
>>  save this stack
>>  close this stack
>>  end mouseUp
>>
>>  If I enter an invalid number and then click in another field, I get 
>>  beep and the contents of the field are restored and all is well. 
>>  However, if I enter an invalid number and then click the "Done" 
>>  button, it looks like the "mouseUp" handler is run BEFORE the 
>>  "closeField" handler. Since the value stored in the stack is the 
>>  invalid data. Is this the correct action? If so, what is the best 
>>  way to make this work so that bad values are not saved in the 
>>  stack. I really don't want to have to validate all fields from the 
>>  "Done" and other buttons on the card.
>
>
>----------------------------------------------------------------
>So Smart Software
>
>For institutions, companies and associations
>Built-to-order applications: management, multimedia, internet, etc.
>Windows, Mac OS and Linux... With the French touch
>
>Free plugins and tutorials on my website
>----------------------------------------------------------------
>Web site        http://www.sosmartsoftware.com/
>Email        eric.chatonet at sosmartsoftware.com/
>Phone        33 (0)1 43 31 77 62
>Mobile        33 (0)6 20 74 50 86
>----------------------------------------------------------------
>
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your 
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your 
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list