Search code examples
c++wxwidgets

How to input value from user and save in variable wxDev-C++


I am new to wxDev-C++, I am pretty familiar with OOP and Dev C++, now I am interested to work with GUI and I found wxDev-C++ as my new friend.

Can any one tell me how to input from user and save it in a variable as we do in Dev?

string input;
cin >> input;

and further process with input. I want to do that in GUI programming using wxDev-C++ or if possible, please give me link to the best book regarding it.

Thanks


Solution

  • I'll assume you've already created a window with wxDev (if not, follow the tutorials). Add a WxTextCtrl.

    Call ->GetLineText(0) on the text control widget to the the first line of text (by default text controls allow only one line of text). You probably want to do this in response to EVT_TEXT_ENTER.