Take Edit Control Value and apply it on a button? Topic is solved
Take Edit Control Value and apply it on a button?
Hello, first of all, im just discovered this forum, and i have been taking a look for a while and i think this forum is quite complete hehe congratulations to their creators
Hummm....other thing i have to say is that im spanish and maybe i will do some gramatical mistakes on my posts, but i have a quite high level of english, so i will try to explain myself as well as i will can...
Well..here we go with my question now...
I started to use WxDevC++ recently and i did some basic programmes, but now i`m trying to do a simple programe for open websites...
I have the interface of my programme done, but the problem is the next...
Im trying to do a programme where you write a web page, into a textbox, and there are other button and when you click on it, the web page that you have written into the textbox gets open....
The problem is that i dont know how can i link the editcontrol and the button, because i want that when i push the button the programme will open my explorer and bring me to the web i have written into the textbox...
I mean...catch the webpage into a variable or something like that and apply it to the button...
Can someone give me a little help please? Explain me the things as slow and clear as possible, remember i`m a begginer in WxDevC++ stuff
Thanx!!
Hummm....other thing i have to say is that im spanish and maybe i will do some gramatical mistakes on my posts, but i have a quite high level of english, so i will try to explain myself as well as i will can...
Well..here we go with my question now...
I started to use WxDevC++ recently and i did some basic programmes, but now i`m trying to do a simple programe for open websites...
I have the interface of my programme done, but the problem is the next...
Im trying to do a programme where you write a web page, into a textbox, and there are other button and when you click on it, the web page that you have written into the textbox gets open....
The problem is that i dont know how can i link the editcontrol and the button, because i want that when i push the button the programme will open my explorer and bring me to the web i have written into the textbox...
I mean...catch the webpage into a variable or something like that and apply it to the button...
Can someone give me a little help please? Explain me the things as slow and clear as possible, remember i`m a begginer in WxDevC++ stuff
Thanx!!
-
- Can't get richer than this
- Posts: 864
- Joined: Thu Jul 28, 2005 9:48 pm
- Location: New Forest, United Kingdom
- Contact:
Hola
Bienvenida a wxForum.
To make the program you describe.
1. Double Click on the button on your frame and it will take you to the code for your button.
2. Add this code into your function
See http://www.wxwidgets.org/manuals/stable ... rlgetvalue
and
http://www.wxwidgets.org/manuals/stable ... ultbrowser
I hope this helps.
Sof.T
Bienvenida a wxForum.
To make the program you describe.
1. Double Click on the button on your frame and it will take you to the code for your button.
2. Add this code into your function
Change the name WxTextCtrl1 for the name of your text control. The function GetValue() returns a wxString which contains the web address that the person has typed in.// insert your code here
wxLaunchDefaultBrowser(WxTextCtrl1->GetValue(), int flags = 0);
See http://www.wxwidgets.org/manuals/stable ... rlgetvalue
and
http://www.wxwidgets.org/manuals/stable ... ultbrowser
I hope this helps.
Sof.T
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
Thanx for the given help, but, as you can see in the screenshot, i put the code you gave me in the button and it says that there are serveral errors...
The code i put into the button was
After erasing the "Insert your code here" thing of course...wxLaunchDefaultBrowser(WxTextCtrl1->GetValue(), int flags = 0);
So...what can i have been doing bad?
Last edited by WxNoob on Tue Jan 29, 2008 6:39 pm, edited 1 time in total.
-
- Can't get richer than this
- Posts: 864
- Joined: Thu Jul 28, 2005 9:48 pm
- Location: New Forest, United Kingdom
- Contact:
The image is not showing, can you post a list of the errors?
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
-
- Can't get richer than this
- Posts: 864
- Joined: Thu Jul 28, 2005 9:48 pm
- Location: New Forest, United Kingdom
- Contact:
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
C:\Documents and Settings\****\Escritorio\Makefile.win [Build Error] exe: *** [Objects/MingW/GeoforceDlg.o] Error 1
C:\Documents and Settings\***\Escritorio\GeoforceDlg.cpp In member function `void GeoforceDlg::WxButton1Click(wxCommandEvent&)':
74 C:\Documents and Settings\***\Escritorio\GeoforceDlg.cpp `WxTextCtrl1' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
I tried with your new code and here you have the errors it shows me when i try to compile...
I tried a lot of ways, but i can
C:\Documents and Settings\***\Escritorio\GeoforceDlg.cpp In member function `void GeoforceDlg::WxButton1Click(wxCommandEvent&)':
74 C:\Documents and Settings\***\Escritorio\GeoforceDlg.cpp `WxTextCtrl1' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
I tried with your new code and here you have the errors it shows me when i try to compile...
I tried a lot of ways, but i can
-
- Can't get richer than this
- Posts: 864
- Joined: Thu Jul 28, 2005 9:48 pm
- Location: New Forest, United Kingdom
- Contact:
You need to change the part of the code that reads WxTextCtrl1 to be the same as the name of your text ctrl that the user types the url into. (My code was just an example). To find the name of the text ctrl look in the properties panel under Name when you select it.
Sof.T
Sof.T
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
You mean that i have to change the name of the Name Propiety of the button?You need to change the part of the code that reads WxTextCtrl1 to be the same as the name of your text ctrl that the user types the url into.
I have to change the propiety that i have underlined in the picture?
I called the button WxButton1 and then i tried with this code
But it still doesnt works...
wxLaunchDefaultBrowser(WxButton1->GetValue());
-
- Can't get richer than this
- Posts: 864
- Joined: Thu Jul 28, 2005 9:48 pm
- Location: New Forest, United Kingdom
- Contact:
I'm glad you solved the problem. I'm sorry I didn't answer your last question, but I have been on holiday in Spain for a week.
Sof.T
Sof.T
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/