From: joakim v. <jo...@ve...> - 2004-03-25 20:49:55
|
I was going to try out my new shiny xml resource based dialog with the following code: ////JAVE /// this is a test to see how to implement a dialog with patricks system /// it replaces tMidiDelayDlg void tPianoWin::ActMidiDelayDialog() { double scale = 0.5; long clockDelay = 10; int repeat = 6; jppResourceDialog dialog(this, "midiDelay"); dialog.Attach("scale", &scale); dialog.Attach("clockDelay", &clockDelay); dialog.Attach("repeat", &repeat); if(dialog.ShowModal() == wxID_OK) { //execute the command // tCmdMidiDelay cmd(Filter, scale,clockDelay,repeat); // cmd.Execute(); Setup();//?? Canvas->SetScrollRanges(); Redraw(); } } //////////// It fails, because there are only long* prototypes of Attach. Is this so by design or because floats havent been implemented? I suspect it's by design, because I couldnt find a "double" capable slider either. I could of course use longs in the gui, and convert to double when sending to the command object. However, how would I show the user a float in the gui in that case? BTW there are some other issues here. The old code is full of global scope variables, which I find un-beautiful. In this case "scale" and so on would be global. It was used so that the dialog would remember state between invocations. Do you still think this is the right way to do it? Cheers, /Joakim |