Jump to content
Attila The Gel

Return a sum to an editbox.

Recommended Posts

Attila The Gel

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

Share this post


Link to post
Share on other sites
Lee Mac

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\"))")

Share this post


Link to post
Share on other sites
Attila The Gel

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 :)!

Share this post


Link to post
Share on other sites
Lee Mac
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:

Share this post


Link to post
Share on other sites
Attila The Gel
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.

Share this post


Link to post
Share on other sites
Lee Mac

No problem Attila, ask away :)

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...