WxTextCtrl as Cmd Out/input

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Cuser
In need of some credit
In need of some credit
Posts: 1
Joined: Thu Nov 24, 2016 9:49 am

WxTextCtrl as Cmd Out/input

Postby Cuser » Thu Nov 24, 2016 12:23 pm

Hello guys,

I am working on Gui Appclication in WxDevc ++ 7.
I have a Button which has a following funktion ... System("ip-config")..
I want get the output in my WxTextCtrl instead in a windows cmdbox.

How can use the WxTextCtrl as a Cmdbox?

There is no Solution @ "google" :(

help me.

User avatar
marcelinux
Knows some wx things
Knows some wx things
Posts: 33
Joined: Thu Nov 07, 2013 9:59 pm
Location: Madrid, Spain

Re: WxTextCtrl as Cmd Out/input

Postby marcelinux » Fri Nov 25, 2016 7:35 am

http://docs.wxwidgets.org/3.0/classwx_process.html
wxProcess also supports IO redirection of the child process. For this, you have to call its Redirect() method before passing it to wxExecute(). If the child process was launched successfully, GetInputStream(), GetOutputStream() and GetErrorStream() can then be used to retrieve the streams corresponding to the child process standard output, input and error output respectively.

I hope this help you.
I just need learn a little bit more. Thank you for your help.

PB
wxWorld Domination!
wxWorld Domination!
Posts: 1308
Joined: Sun Jan 03, 2010 5:45 pm

Re: WxTextCtrl as Cmd Out/input

Postby PB » Fri Nov 25, 2016 8:12 am

By the way, the bundled "exec" sample demonstrates how to capture and display output of another process.

jgrzybowski
Earned some good credits
Earned some good credits
Posts: 113
Joined: Sat Sep 24, 2011 9:32 pm
Location: Poland

Re: WxTextCtrl as Cmd Out/input

Postby jgrzybowski » Fri Nov 25, 2016 10:49 am

If output of your function is a text (wxString) you can show it inside of wxTextCtrl in this way:

Code: Select all

textctrlYourTextCtrl->AppendText(stringYourOutputText);

If output of your function is a number (int, long, etc) you can show it inside of wxTextCtrl in this way:

Code: Select all

textctrlYourTextCtrl->AppendText(wxString::Format(wxT("%d"), intYourOutputNumber));

regards, Jarek


Return to “wxDev-C++”

Who is online

Users browsing this forum: No registered users and 2 guests