Jump to content

Return a sum to an editbox.


Attila The Gel

Recommended Posts

Hi,

 

Can some one show me how I can get the below code to work?

I cant seem to return a result of formula to an edit box.

 

as you can see from the code snip below, when I type a real number in edit box 1 I would like to get the sum of edit box 1 and 154 to edit box 2. and the same with edit box 2 but then minus 154.

 

 

(action_tile "eb1"
[indent][indent]"(setq eb1 $value)
(set_tile \"eb2\" (+ eb1 154)") ;NOT WORKING
[/indent]
[/indent](action_tile "eb2"
[indent][indent]"(setq eb2 $value)
(set_tile \"eb1\" (- eb2 154)") ;NOT WORKING
[/indent]
[/indent]

thanks

Edited by Attila The Gel
Solved
Link to comment
Share on other sites

edit_box tiles use strings and tile keys should also be strings, not symbols, hence I would suggest:

 

(action_tile "eb1" "(set_tile \"eb2\" (if (setq eb1 (distof $value)) (rtos (+ eb1 154)) \"N/A\"))")
(action_tile "eb2" "(set_tile \"eb1\" (if (setq eb2 (distof $value)) (rtos (- eb2 154)) \"N/A\"))")

Link to comment
Share on other sites

Thx Lee Mac,

 

thats almost perfect. Just that the result is with precision 0.0000 what do i need to change in order to get a rounded number.

 

if eb1 = 2000 then eb2 = 2145 and not 2145.0000.

 

thx again

its nice to know that you still rock here :)!

Link to comment
Share on other sites

Just that the result is with precision 0.0000 what do i need to change in order to get a rounded number.

 

Read the documentation on the rtos function :thumbsup:

 

its nice to know that you still rock here :)!

 

Cheers dude! :beer:

Link to comment
Share on other sites

Read the documentation on the rtos function

 

Just read it and problem solved.

 

I may have some new questions as I'm trying to learn Lisp and DCL until my lisp programming lessons start on 10/10.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...