Acquiring form value from event C++

Discussion of features and help with problems encountered while using libRocket

Acquiring form value from event C++

Postby JeeseJames on Sun Nov 10, 2013 10:00 am

I'm very new to libRocket, as well as posting to programming forums, hope I don't mess this up too bad....

I have registered an Event Listener for type "change", which is the type of event I have notice occurs when a selection in a drop down menu is made. What I would like is to acquire the value that was selected from the event. I see that it gets put in some dictionary, but I don't understand how to use it. I've also seen someone do some tom foolery (for lack of a better term) getting access to the ElementFormControlSelect through some GetCurrentElement and GetOwnerElement calls on event, but I don't understand how that happened either.

I know if I have the ElementFormControlSelect I can call GetSelection to get the value I want, and I believe it is in the dictionary. Can someone help me gain access to this value? I can supply any further information needed.
Posts: 1
Joined: Sun Nov 10, 2013 9:49 am

Re: Acquiring form value from event C++

Postby aquawicket on Fri Mar 20, 2015 10:05 pm

I do it like this. When you receive the event.....

Code: Select all
if(event.GetType() == "change"){
     DKElementFormControl* ele = static_cast<DKElementFormControl*>(event.GetCurrentElement());
     std::string value = ele->GetValue().CString();  //get the value of the selected option
Posts: 8
Joined: Fri Jun 27, 2014 6:07 am

Return to Using libRocket