keyboard event Topic is solved
-
- Knows some wx things
- Posts: 29
- Joined: Wed May 09, 2007 1:01 am
- Location: Manila,Philippines
- Contact:
keyboard event
Does anyone here knows on how to make the cursor of a wxTextField to transfer to another wxTextField by pressing the tab on the keyboard....
Example,,,suppose you have two txtFields in the frame and the cursor of the mouse is in one of the txtfield and byy pressing the tab of your keyboard the cursor will transfer on the second text field....
I hope you have the idea about this one............
Thanks in advanced...
Example,,,suppose you have two txtFields in the frame and the cursor of the mouse is in one of the txtfield and byy pressing the tab of your keyboard the cursor will transfer on the second text field....
I hope you have the idea about this one............
Thanks in advanced...
What important in a problem is not the solution but the lessons you learned in finding the solution.
-
- I live to help wx-kind
- Posts: 196
- Joined: Tue Dec 07, 2004 8:54 pm
- Location: Essen, Germany
Define a custom EVT_SET_FOCUS event handler for all you text controls. In the event handler call It will point the mouse cursor to the top-left corner of the control.
Code: Select all
WarpPointer(wxPoint(0, 0));
-
- Knows some wx things
- Posts: 29
- Joined: Wed May 09, 2007 1:01 am
- Location: Manila,Philippines
- Contact:
thank you megabyte for your response about my question in the forum about the the text ctrl but I am still confuse....
Could you pls help me on how to define these event for i dont have an idea about this one or provide me a simple program about this one.....
I hope you could help me this one.......if u r bc its,alright,, i can wait for your reply
Could you pls help me on how to define these event for i dont have an idea about this one or provide me a simple program about this one.....
I hope you could help me this one.......if u r bc its,alright,, i can wait for your reply
What important in a problem is not the solution but the lessons you learned in finding the solution.
-
- I live to help wx-kind
- Posts: 196
- Joined: Tue Dec 07, 2004 8:54 pm
- Location: Essen, Germany
Not a problem. Code snippet isand the control usage is the same as wxTextCtrl, i.e.
Code: Select all
class MyTextCtrl : public wxTextCtrl
{
public:
MyTextCtrl(wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size, int style = 0)
: wxTextCtrl(parent, id, value, pos, size, style)
{
}
void OnSetFocus(wxFocusEvent& event);
private:
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(MyTextCtrl, wxTextCtrl)
EVT_SET_FOCUS(MyTextCtrl::OnSetFocus)
END_EVENT_TABLE()
void MyTextCtrl::OnSetFocus(wxFocusEvent& event)
{
WarpPointer(wxPoint(0, 0));
event.Skip();
}
Code: Select all
MyTextCtrl *pMyText = new MyTextCtrl( this, wxID_ANY, _T(""), wxPoint(10,50), wxSize(140,wxDefaultCoord));
-
- Super wx Problem Solver
- Posts: 426
- Joined: Mon May 29, 2006 10:50 pm
- Location: Jena, Germany
Do you want to move the mouse-cursor by program or do you want to move the keyboard-cursor (the blinking " | " ) ? The latter should work automatically, if you create "textfield_1" before "textfield_2" and put them both on panels.
Try to run some sample-apps from wxWidgets (i.e. the text-sample) to get an idea on how it works.
Try to run some sample-apps from wxWidgets (i.e. the text-sample) to get an idea on how it works.
OS: Windows XP Home, Compiler: MingW, Version: wxWidgets 2.8.0, IDE: wx-Devcpp
-
- Knows some wx things
- Posts: 29
- Joined: Wed May 09, 2007 1:01 am
- Location: Manila,Philippines
- Contact:
thanks for the response
Thnkz clyde for your effort to help.....What i wanted is to move the keyboard cursor on the nxt textfield by pressing the keyboard tab so that i could write on the next txtfield...
As you have said that this must work automatically if the txtfield1 before txtfield2 but on my program it doesnt work....My txtfields in not on the panel but on the same frame...I hope you could help me with this one
Thanks......
As you have said that this must work automatically if the txtfield1 before txtfield2 but on my program it doesnt work....My txtfields in not on the panel but on the same frame...I hope you could help me with this one
Thanks......
What important in a problem is not the solution but the lessons you learned in finding the solution.
-
- I live to help wx-kind
- Posts: 196
- Joined: Tue Dec 07, 2004 8:54 pm
- Location: Essen, Germany
I thought about a mouse cursor. So my code does not solve your problem. As it was mentioned before, the text cursor should appear automatically in every text control after it become focused.
There are not so much details, to decide what is the problem reason. Can you post your code which creates the text controls.
There are not so much details, to decide what is the problem reason. Can you post your code which creates the text controls.
-
- Knows some wx things
- Posts: 29
- Joined: Wed May 09, 2007 1:01 am
- Location: Manila,Philippines
- Contact:
thanks for concern and here is my code
Thanks ,,,megabyte for your help,,,I really appreciate your concern...Thank you very much.....Thanks
Here is my code ::::
Here is my code ::::
- Attachments
-
- txtctrl.cpp
- what i wanted is that if the cursor is on the first txtfield and if u enter the tab key of the keyboard the txtcursor will move to the nxt txt field......Thanks a lot for your help
- (758 Bytes) Downloaded 69 times
What important in a problem is not the solution but the lessons you learned in finding the solution.
-
- Knows some wx things
- Posts: 29
- Joined: Wed May 09, 2007 1:01 am
- Location: Manila,Philippines
- Contact:
thanks for concern and here is my code
Thanks ,,,megabyte for your help,,,I really appreciate your concern...Thank you very much.....Thanks
Here is my code ::::
Here is my code ::::
- Attachments
-
- txtctrl.cpp
- what i wanted is that if the cursor is on the first txtfield and if u enter the tab key of the keyboard the txtcursor will move to the nxt txt field......Thanks a lot for your help
- (758 Bytes) Downloaded 61 times
What important in a problem is not the solution but the lessons you learned in finding the solution.
-
- Knows some wx things
- Posts: 29
- Joined: Wed May 09, 2007 1:01 am
- Location: Manila,Philippines
- Contact:
here is my code and thanks
Thanks ,,,megabyte for your help,,,I really appreciate your concern...Thank you very much.....Thanks
Here is my code ::::
#include "wx/wx.h"
class MyApp: public wxApp{
virtual bool OnInit();
};
class MyFrame: public wxFrame{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,long style);
};
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit(){
MyFrame *frame = new MyFrame( _T("PhoneToPhone"), wxPoint(310,200), wxSize(425,319),wxSYSTEM_MENU|wxCLOSE_BOX);
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,long style)
: wxFrame((wxFrame *)NULL, -1, title, pos, size,style){
wxTextCtrl *txtctrl=new wxTextCtrl(this,-1,_T(""),wxPoint(140,25),wxSize(130,25));
wxTextCtrl *txtctrl_1=new wxTextCtrl(this,-1,_T(""),wxPoint(140,130),wxSize(130,25));
}
What i wanted is that if the cursor is on the first txtfield and if u enter the tab key of the keyboard the txtcursor will go to the nxt txtfield so that u can write on it..
Thanks for your hellp...I really appreciate your hellp....Thank you...
Here is my code ::::
#include "wx/wx.h"
class MyApp: public wxApp{
virtual bool OnInit();
};
class MyFrame: public wxFrame{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,long style);
};
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit(){
MyFrame *frame = new MyFrame( _T("PhoneToPhone"), wxPoint(310,200), wxSize(425,319),wxSYSTEM_MENU|wxCLOSE_BOX);
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,long style)
: wxFrame((wxFrame *)NULL, -1, title, pos, size,style){
wxTextCtrl *txtctrl=new wxTextCtrl(this,-1,_T(""),wxPoint(140,25),wxSize(130,25));
wxTextCtrl *txtctrl_1=new wxTextCtrl(this,-1,_T(""),wxPoint(140,130),wxSize(130,25));
}
What i wanted is that if the cursor is on the first txtfield and if u enter the tab key of the keyboard the txtcursor will go to the nxt txtfield so that u can write on it..
Thanks for your hellp...I really appreciate your hellp....Thank you...
What important in a problem is not the solution but the lessons you learned in finding the solution.
-
- I live to help wx-kind
- Posts: 196
- Joined: Tue Dec 07, 2004 8:54 pm
- Location: Essen, Germany
I compiled you code. I have two borderless text controls in a frame without any caption and border, the controls have text cursors if to focus them using mouse, but the Tab does not work due to the wxTAB_TRAVERSAL flag missing. So I changed the frame creation lineAfter this the frame controls are tab traversal. Unfortunately I cannot to reproduce your problem with missing text cursors.
Code: Select all
MyFrame *frame = new MyFrame( _T("PhoneToPhone"), wxPoint(310,200), wxSize(425,319),wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL);
-
- Knows some wx things
- Posts: 29
- Joined: Wed May 09, 2007 1:01 am
- Location: Manila,Philippines
- Contact:
thanks,,megabyte
Thankz for your effort to help me...thank you..
What important in a problem is not the solution but the lessons you learned in finding the solution.
-
- Earned some good credits
- Posts: 146
- Joined: Sun Nov 26, 2006 7:37 am
- Location: Tennessee, USA
- Contact:
I dont think he had a problem of missing text cursors. I think he only wanted the wxTAB_TRAVERSAL, as was stated in his first post when he mentioned the need to use "TAB" to go between controls. However if he is missing the actual cursor then it is a problem in the software of not letting the OS know what type of control it is in, and handling that properly.megabyte wrote:I compiled you code. I have two borderless text controls in a frame without any caption and border, the controls have text cursors if to focus them using mouse, but the Tab does not work due to the wxTAB_TRAVERSAL flag missing. So I changed the frame creation lineAfter this the frame controls are tab traversal. Unfortunately I cannot to reproduce your problem with missing text cursors.Code: Select all
MyFrame *frame = new MyFrame( _T("PhoneToPhone"), wxPoint(310,200), wxSize(425,319),wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL);
JS
OS Windows XP Pro
Compiler MinGW 3.4.5
wxWidgets 2.8.7 (Unicode : Monolithic : Release)
IDE Code::Blocks (Latest Release)
RAD wxFormBuilder (Latest Release)
Compiler MinGW 3.4.5
wxWidgets 2.8.7 (Unicode : Monolithic : Release)
IDE Code::Blocks (Latest Release)
RAD wxFormBuilder (Latest Release)
-
- Knows some wx things
- Posts: 29
- Joined: Wed May 09, 2007 1:01 am
- Location: Manila,Philippines
- Contact:
thnksz
thanks for your response and i think you got the right point coz currently i am using the ubuntu flavor of linux and the TAB_TRANSVERSAL doesn't work in linux but in win32 it works,,,so i think it is in the OS...
What important in a problem is not the solution but the lessons you learned in finding the solution.