PDA

View Full Version : blit box callback


cridalab
06-12-2008, 05:46 PM
hello,

I'm having trouble setting the radio box state.
Normally a radio box is highlighted when clicked. But if I put some lisp code in the pick callback clicking runs the callback but does not highlight it, so the user can't see which is selected. (The same problem applies to check boxes.)

So, how do I forcefully highlight a radio box?
I thought there might be an object variable but I haven't guessed it yet:
(setobjectvarbydesc radio "Value" 1)

thanks,
Richard

cridalab
06-12-2008, 05:57 PM
Also, this widget is called a "Radio Box" in the EC menu but to access it through lisp you have to use "Option Button", while check boxes use the same name for both.

vertigo
06-12-2008, 09:08 PM
Richard,

The LISP command you are looking for is

(setobject2dstate <object> <state> <value>)

"Sets the state of a 2D object. For example, the state can be a clear or selected radio button or check box. This function can only be called for the following object types: 2D Edit Box, 2D Button, 2D Radio Button, 2D Check Box, 2D Slider, or 2D Progress Bar."

Look at the sample '2D_UI Sampler.rsn' Also check out the Lisp samples. These samples will give you a good understanding of the syntax and how Script is used to control your scene.

Cheers!

cridalab
06-12-2008, 10:06 PM
thanks for the pointer vertigo. Any idea why the callback was suppressing the highlight? I saw in one of your examples you put (exit) at the end of your button click callbacks. Was that related?

vertigo
06-13-2008, 05:02 AM
hey cridalab,

Glad to help.

The callback must return true or T for the 2D event to process. If you take a look at the documentation for SceneObjectUIChange you will find more detail.

If this callback returns nil or false (Lisp or C respectively), the event for that 2D object is canceled. For example, you cannot drag the slider bar if nil or false is returned by this callback.

cridalab
06-15-2008, 06:15 PM
thanks for the hint. I played around with my code and realized that the content of the callback function was the problem. In the callback I was creating some dynamic planes which seemed to be interfering with the event cycle.
So in the end I just did it manually:


(defun selectOption (option)
(setq children (getChildren OPTION_GROUP))
(setq child_i 0)
(while (< child_i (length children))
(setobject2dstate (nth child_i children) 0 0)
(setq child_i (+ child_i 1))
)
(setobject2dstate option 0 1)
)