hi masters,
Here i face some problem in getting an ID of a disabled button, by right clicking over on it.
I used context menu event, but i got the panel id only where the button has been created over it.
Please give some suggestion for it.
Thanks in Advance,
Ebe
event id of a disabled button
Re: event id of a disabled button
Please share some code
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
-
- Experienced Solver
- Posts: 65
- Joined: Sun Oct 26, 2008 5:15 am
- Location: Chennai, India
- Contact:
Re: event id of a disabled button
Hi Ebe:
wxWindowID theId = myDisabledButton->GetId();
wxWindowID theId = myDisabledButton->GetId();
Regards,
Nelson Joseph
Nelson Joseph
Re: event id of a disabled button
Sure!..Auria..Auria wrote:Please share some code
Code: Select all
{
oneButton = new wxBitmapButton( m_pTopLeftPanel, wxID_BUTTON_1, wxBitmap( wxT(""),wxBITMAP_TYPE_PNG ),wxDefaultPosition, MAXBUTTONSIZE,wxBU_EXACTFIT,wxDefaultValidator);
oneButton ->SetLabel(wxT("1"));
oneButton->Disable();
twoButton = new wxBitmapButton( m_pTopLeftPanel, wxID_BUTTON_2, wxBitmap( wxT(""),wxBITMAP_TYPE_PNG ),wxDefaultPosition, MAXBUTTONSIZE,wxBU_EXACTFIT,wxDefaultValidator);
twoButton ->SetLabel(wxT("2"));
twoButton->Disable();
threeButton= new wxBitmapButton( m_pTopLeftPanel, wxID_BUTTON_3, wxBitmap( wxT(""),wxBITMAP_TYPE_PNG ),wxDefaultPosition, MAXBUTTONSIZE,wxBU_EXACTFIT,wxDefaultValidator);
threeButton->SetLabel(wxT("3"));
threeButton->Disable();
fourButton = new wxBitmapButton( m_pTopLeftPanel, wxID_BUTTON_4, wxBitmap( wxT(""),wxBITMAP_TYPE_PNG ),wxDefaultPosition, MAXBUTTONSIZE,wxBU_EXACTFIT,wxDefaultValidator);
fourButton ->SetLabel(wxT("4"));
fiveButton = new wxBitmapButton( m_pTopLeftPanel, wxID_BUTTON_5, wxBitmap( wxT(""),wxBITMAP_TYPE_PNG ),wxDefaultPosition, MAXBUTTONSIZE,wxBU_EXACTFIT,wxDefaultValidator);
fiveButton ->SetLabel(wxT("5"));
}
//context menu
{
int eventID = event.GetId();
wxMenu* menu = new wxMenu;
menu->Append( wxID_FORCETOEDIT, wxT( "&Edit" ));
if( eventID == wxID_BUTTON_1 && !oneButton->IsEnabled())
PopupMenu( menu, wxDefaultPosition );
else if( eventID == wxID_BUTTON_2 && !twoButton->IsEnabled())
PopupMenu( menu, wxDefaultPosition );
else if( eventID == wxID_BUTTON_3 && !threeButton->IsEnabled())
PopupMenu( menu, wxDefaultPosition );
else if( eventID == wxID_BUTTON_4 && !fourButton->IsEnabled())
PopupMenu( menu, wxDefaultPosition );
else if( eventID == wxID_BUTTON_5 && !fiveButton->IsEnabled())
PopupMenu( menu, wxDefaultPosition );
}
Re: event id of a disabled button
okay but how do you catch the right click, and also which code do you execute on right-clicks that tries to get the event (if I understood correctly)
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
Re: event id of a disabled button
thanks for ur quick reply.. here iam using (wxContextMenuEvent& event).Auria wrote:okay but how do you catch the right click, and also which code do you execute on right-clicks that tries to get the event (if I understood correctly)
while i right click over the enabled button i can popup a context menu by getting the event id,
but my need is to popup a context menu over the disabled button by getting the id of which button the mouse is over on.
Re: event id of a disabled button
instead of using context menu events, I suggest just using a regular wxMouseEvent with EVT_RIGHT_DOWN
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
Re: event id of a disabled button
yes..! i tried that.Auria wrote:instead of using context menu events, I suggest just using a regular wxMouseEvent with EVT_RIGHT_DOWN
Since the button is already disabled, I could not capture EVT_RIGHT_DOWN event.