I think sivan k wrote:

> Regarding the no such variable text error - I have not used
> ?text variable outside the function if I have understood you
> correctly. 

Well, I don't know. I was curious enough to take your code and run it.
It works for me with your "test.java" exactly as shown (adding an
"import jess.*", of course), and with a few lines of initialization
added to the Jess code.  I can select something from the combo box,
press the button, and get that thing printed. Because Jess 7 includes
some changes in how Context works, I tried this with both Jess 6 and
7; it works with both.

Here's my complete Jess program:

; ----------------------------------------------------------------------
(load-function  test)
(import javax.swing.*)

(defglobal ?*argcombo* = (new JComboBox (create$ A B C)))
(defglobal ?*ok* = (new JButton OK))

(bind ?frame (new JFrame))
((?frame getContentPane) add ?*ok* "South")
((?frame getContentPane) add ?*argcombo* "Center")
(?frame pack)
(?frame setVisible TRUE)

(deffunction inputstring (?EVENT)
  (bind ?arg (sym-cat (?*argcombo* getSelectedItem)))
  (compute ?text ?arg)
  (printout t ?text))

(bind ?handler (new jess.awt.ActionListener inputstring(engine)))

(?*ok*  addActionListener ?handler)





---------------------------------------------------------
Ernest Friedman-Hill  
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to