TechSlider
TechSlider
I'm having problems changing the StaticText to a wxTextCtrl() so that numbers can be entered manually.
Or rather, I've changed it OK, but setting up the event handlers in TechSlider() is going nowhere fast, because of
a) BEGIN_EVENT_TABLE(class, parent)
requires that the TechSlider class be based upon some wx class or something, which it currently isn't. (ie, what to set parent to?)
b) I'm getting errors using text.GetValue() - compiler says that it's undeclared.
Anyone want to help me on this?
Or rather, I've changed it OK, but setting up the event handlers in TechSlider() is going nowhere fast, because of
a) BEGIN_EVENT_TABLE(class, parent)
requires that the TechSlider class be based upon some wx class or something, which it currently isn't. (ie, what to set parent to?)
b) I'm getting errors using text.GetValue() - compiler says that it's undeclared.
Anyone want to help me on this?
ok, i now want to resolve this issue...
basically what I'm trying to implement is the event handler from pressing the return key in the wxTextCtrl so that a user-entered value updates the slider value.
It seems impossible to have the EVENT_TABLE in the TechSlider class for some reason...
however the events do get passed back up the control hierarchy to MainWindow, and using
EVT_TEXT_ENTER(wxID_ANY, MainWindow::onTxtEnter)
works.
The trouble is, that the generated wxCommandEvent contains an ID for the wxTextCtrl only, and there's no association between the TechSlider class that created it, or the wxSlider control that is also in that class. Therefore, we can't update the slider value - or can we?
HELP!
basically what I'm trying to implement is the event handler from pressing the return key in the wxTextCtrl so that a user-entered value updates the slider value.
It seems impossible to have the EVENT_TABLE in the TechSlider class for some reason...
however the events do get passed back up the control hierarchy to MainWindow, and using
EVT_TEXT_ENTER(wxID_ANY, MainWindow::onTxtEnter)
works.
The trouble is, that the generated wxCommandEvent contains an ID for the wxTextCtrl only, and there's no association between the TechSlider class that created it, or the wxSlider control that is also in that class. Therefore, we can't update the slider value - or can we?
HELP!
it does nowOnoSendai wrote:Techslider is just a kind of wrapper class, it doesn't inherit from any of the wx classes IIRC.

Code: Select all
TechSlider::TechSlider(const std::string& label, wxWindow* parent, wxSizer* parent_sizer, float min_val_, float max_val_, float default_val_)
: wxBoxSizer(wxHORIZONTAL),
min_val(min_val_),
max_val(max_val_),
default_val(default_val_)
but still, the event handling doesn't work.
Who is online
Users browsing this forum: No registered users and 2 guests