Rebol Talk Forum  |  REBOL Discussions  |  REBOL View  |  Topic: /View event handling?
Pages: [1] Print
Author Topic: /View event handling?  (Read 428 times)
yeksoon
Newbie
*
Offline Offline

Posts: 1


View Profile
/View event handling?
« on: November 23, 2004, 07:44:44 AM »

I am trying to find some documentation for event handling in /View.

Some simple things that I am looking for.

eg.
view layout [
price: field
cost: field
net_amt: field

]


what I want to look for is when user key in data in fields price and cost... and once the user tab to go to the last field, it should do some calculation and assinged the result to "net_amt".

I don't seems to find docs on event handling on RT's site.

Any links or examples. Thanks

 
Logged
CarlRead
Full Member
***
Offline Offline

Posts: 105


View Profile
/View event handling?
« Reply #1 on: November 23, 2004, 11:06:49 PM »

The contents of a block after FIELD will be evaluated when the user presses Tab (or Enter or just exits the field), so you can use that to have the third field automatically updated. ie, with something like this...
Code:
calc-net: func [][
   if error? try [p: to-decimal price/text][p: 0]
   if error? try [c: to-decimal cost/text][c: 0]
   net-amt/text: to-string p + c
   show net-amt
]
view layout [
   price: field [calc-net]
   cost: field [calc-net]
   net-amt: field
]
For more complex event-handling, the User Interface Events "How-to" (here: http://www.rebol.com/how-to.html ) goes into quite a bit of detail.

Hope that helps.
 
Logged

- Carl Read
Pages: [1] Print 
Rebol Talk Forum  |  REBOL Discussions  |  REBOL View  |  Topic: /View event handling?
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2008, 03:01:35 AM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2285 Posts in 594 Topics by 3699 Members
Latest Member: BypeScieple

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc