> Since the values for all those widgets can change dynamically 
> (eg, user switches channel or turns the volume knob on the 
> synthesizer) I need some way to reference to a widget by the 
> parameter number that they control. For example: the user 
> switches the channel. the app will ask for the volume of the 
> current channel. The device responses with something like 
> "130, 50" where 130 is the ID of "channel volume" and "50" is 
> the value. Now i need to set the channel volume slider to the 
> new value.
> 
> You can probably see that it would be great if i could just 
> do something like set_widget(130, 50); without an explicit 
> mapping of parameter_ID->widget_name
> 
> Also how to best handle this many widgets? I could continue 
> adding widgets to my window class from the FLUID tutorial. 
> But that would make things kinda confusing/complex.

Rather than using fluid to build your UI, maybe you can build it
programmatically, and also keep an array of pointers to all your
widgets, like...

Fl_Widget *widget_array[200];
int idx = 0;
        :
        :
Fl_Button *bt1 = new Fl_Button(....
widget_array[idx++] = (Fl_Widget *)bt1;
        :
        :

Then your set_widget(130, 50); would perhaps become something like...

set_widget(int id, float val) {
  widget_array[id]->value(val);
}






SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to