sorry to resurrect this older thread.
TestPopupsGUI.bmx
and TestPopups.bmx
The current version of wxCodeGen seems to generate the 2 connect lines which i have commented out.
' Connect(ID_lb1, wxEVT_RIGHT_UP, _RightClickForPopup)
' Connect(ID_lb2, wxEVT_RIGHT_UP, _RightClickForPopup)
but these two are the ones that work in this example for the listboxes.
m_listBoxPopup1.ConnectAny(wxEVT_RIGHT_UP, _RightClickForPopup, Null, Self)
m_listBoxPopup2.ConnectAny(wxEVT_RIGHT_UP, _RightClickForPopup, Null, Self)
also the Function _RightClickForPopup(event:wxEvent) has MyFrame2Base(event.sink) whereas the current wxCodeGen gives me MyFrame2Base(event.parent) whcih my listbox is not responding to.
am i doing something wrong?
Cheers
Glenn
TestPopupsGUI.bmx
' ' BlitzMax code generated with wxCodeGen v0.96 : 25 Feb 2008 23:22:05 ' ' ' PLEASE DO "NOT" EDIT THIS FILE! ' SuperStrict Import wx.wxFrame Import wx.wxListBox Import wx.wxPanel Import wx.wxWindow Import wx.wxMouseEvent Type MyFrame2Base Extends wxFrame Field m_panel5:wxPanel Field m_listBoxPopup1:wxListBox Field m_listBoxPopup2:wxListBox Field m_listBoxNoPopup:wxListBox Const ID_lb1:Int = 1000 Const ID_lb2:Int = 1001 Method Create:MyFrame2Base(parent:wxWindow = Null,id:Int = wxID_ANY, title:String = "", x:Int = -1, y:Int = -1, w:Int = 500, h:Int = 300, style:Int = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL) Return MyFrame2Base(Super.Create(parent, id, title, x, y, w, h, style)) End Method Method OnInit() Local bSizer11:wxBoxSizer bSizer11 = New wxBoxSizer.Create(wxVERTICAL) m_panel5 = New wxPanel.Create(Self, wxID_ANY,,,,, wxTAB_TRAVERSAL) Local bSizer12:wxBoxSizer bSizer12 = New wxBoxSizer.Create(wxVERTICAL) m_listBoxPopup1 = New wxListBox.Create(m_panel5, ID_lb1, Null) bSizer12.Add(m_listBoxPopup1, 0, wxALL, 5) m_listBoxPopup2 = New wxListBox.Create(m_panel5, ID_lb2, Null) bSizer12.Add(m_listBoxPopup2, 0, wxALL, 5) m_listBoxNoPopup = New wxListBox.Create(m_panel5, wxID_ANY, Null) bSizer12.Add(m_listBoxNoPopup, 0, wxALL, 5) m_panel5.SetSizer(bSizer12) m_panel5.Layout() bSizer11.Add(m_panel5, 1, wxEXPAND | wxALL, 5) SetSizer(bSizer11) Layout() ' Connect(ID_lb1, wxEVT_RIGHT_UP, _RightClickForPopup) ' Connect(ID_lb2, wxEVT_RIGHT_UP, _RightClickForPopup) m_listBoxPopup1.ConnectAny(wxEVT_RIGHT_UP, _RightClickForPopup, Null, Self) m_listBoxPopup2.ConnectAny(wxEVT_RIGHT_UP, _RightClickForPopup, Null, Self) End Method Function _RightClickForPopup(event:wxEvent) MyFrame2Base(event.sink).RightClickForPopup(wxMouseEvent(event)) End Function Method RightClickForPopup(event:wxMouseEvent) DebugLog "Please override MyFrame2.RightClickForPopup()" event.Skip() End Method End Type
and TestPopups.bmx
' ' Example application stub generated by wxCodeGen v0.96 : 25 Feb 2008 20:01:20 ' SuperStrict Framework wx.wxApp Import "TestPopupsGUI.bmx" Import brl.filesystem Import brl.system New MyApp.run() Type MyApp Extends wxApp Field frame:MyFrame2 Method OnInit:Int() ?macos ' make the default Mac font for controls not so big wxSystemOptions.SetOption(wxWINDOW_DEFAULT_VARIANT, wxWINDOW_VARIANT_SMALL) ? wxInitAllImageHandlers() wxImage.AddHandler( New wxXPMHandler ) ' for Mac/Win32 (it is default on Linux) Local frame:MyFrame2 = MyFrame2(New MyFrame2.Create(, , "Test Popup Menu Selection")) frame.show() SetTopWindow(frame) Return True End Method End Type Type MyFrame2 Extends MyFrame2Base Method OnInit() Super.OnInit() ' Add own initialisation code here End Method Method RightClickForPopup(event:wxMouseEvent) Select event.GetId() Case ID_lb1 DebugLog "You clicked on Boris!" Case ID_lb2 DebugLog "You clicked on Fred!" End Select End Method End Type
The current version of wxCodeGen seems to generate the 2 connect lines which i have commented out.
' Connect(ID_lb1, wxEVT_RIGHT_UP, _RightClickForPopup)
' Connect(ID_lb2, wxEVT_RIGHT_UP, _RightClickForPopup)
but these two are the ones that work in this example for the listboxes.
m_listBoxPopup1.ConnectAny(wxEVT_RIGHT_UP, _RightClickForPopup, Null, Self)
m_listBoxPopup2.ConnectAny(wxEVT_RIGHT_UP, _RightClickForPopup, Null, Self)
also the Function _RightClickForPopup(event:wxEvent) has MyFrame2Base(event.sink) whereas the current wxCodeGen gives me MyFrame2Base(event.parent) whcih my listbox is not responding to.
am i doing something wrong?
Cheers
Glenn