25856

GUI layout with wxSizer, wxSashWindow

Question:

I'm trying to create a window which is splitted into 2, 3, 4 etcc different resizable views in mainwindow and I'd like to implement that with wxWidgets in C::B. Actually th canvas itself splits the windows in the requested numbers, but it doesn't place any sash alongn the border of views so that it's very diffciult to notice which view starts where and ends where.

I create everything on run time and I was planing to place the sash, or panels around borders of views and hoping to work in my case but the main frame is reluctant to place the panels, and sashwidnwos at the correct position and stops processing the OnSize event. That is previously working codes is not functioning properly if I add the below code with sizers and panels during resizing.

MainFrame *frame = new MainFrame(NULL, wxT("wxWidgets OSG Sample"), wxDefaultPosition, wxSize(width, height)); wxToolBar* toolbar = new wxToolBar(frame, wxID_ANY,wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL); //wxSashLayoutWindow* win = new wxSashLayoutWindow(frame, ID_WINDOW_TOP,wxPoint(50,10), wxSize(200, 30), // wxSW_3D | wxCLIP_CHILDREN); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); wxPanel* panel = new wxPanel(frame, ID_TBbutton, wxPoint(300,0), wxSize(5,500)); panel->SetWindowStyle(wxDOUBLE_BORDER); // panel->SetStyle(wx_3D) wxPanel* panel1 = new wxPanel(frame, ID_TBbutton); sizer->Add( panel, 0, wxALL, 0 ); frame->SetSizer(sizer); frame->SetToolBar(toolbar);

Answer1:

Please find below very basic example of MDI form with <a href="http://docs.wxwidgets.org/stable/classwx_sash_layout_window.html" rel="nofollow">wxSashLayoutWindow</a>:

bool SashWindowTestApp::OnInit() { wxMDIParentFrame* mainFrame = new wxMDIParentFrame(NULL, ID_TEST_FRAME, wxT("Sash window test"), wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE); // top window wxSashLayoutWindow* topWindow = new wxSashLayoutWindow(mainFrame, ID_WINDOW_TOP, wxDefaultPosition, wxSize(200, 100), wxSW_3D); topWindow->SetDefaultSize(wxSize(1000, 100)); topWindow->SetAlignment(wxLAYOUT_TOP); topWindow->SetBackgroundColour(*wxGREEN); topWindow->SetSashVisible(wxSASH_BOTTOM, true); // bottom window wxSashLayoutWindow* bottomWindow = new wxSashLayoutWindow(mainFrame, ID_WINDOW_BOTTOM, wxDefaultPosition, wxSize(200, 200), wxSW_3D); bottomWindow->SetDefaultSize(wxSize(1000, 200)); bottomWindow->SetAlignment(wxLAYOUT_BOTTOM); bottomWindow->SetBackgroundColour(*wxYELLOW); bottomWindow->SetSashVisible(wxSASH_TOP, true); wxLayoutAlgorithm layout; layout.LayoutMDIFrame(mainFrame); mainFrame->Show(true); return true; }

In order to have a fully working sash window your frame has to react on <a href="http://docs.wxwidgets.org/stable/classwx_sash_event.html" rel="nofollow">EVT_SASH_DRAGGED</a>

Recommend

  • GUI layout with wxSizer, wxSashWindow
  • Classic ASP IIS 6 Response buffer limit exceeded
  • Line Chart Not Connecting Dots (Sencha-Charts Package)
  • Should I encode special character in my sitemaps?
  • Regular Expression to match string within a square bracket
  • New line and dollar sign in Java regular expression
  • Error 91 (Object Not Set) When Finding Data in Closed Workbook
  • Efficient way of calling set of functions in Python
  • Swing: Canvas overlaps menu
  • SSO, using Google Apps user database
  • How to find via Python the icon associated with a Windows file?
  • Cannot access vm using GCloud Compute
  • Confusion in RegExp Reluctant quantifier? Java
  • Android Oreo JobIntentService Keep running in background for Android 7 &below and crashing often
  • Multilingual set up of codeigniter
  • Is there an HTML code that can make my background picture transparent and my text non-transparent?
  • Is a .txt file created in VB different than one I'd randomly create?
  • WooCommerce hook after order is updated?
  • Return to second to last URL in MVC (return View with previous filter conditions applied)?
  • remove unicode characters but keep all special and English characters with preg_replace
  • Lua: Line breaks in strings
  • Python PIL to extract number from image
  • Optimizing the print function in Matlab
  • Is there a way to save the selected text and highlight it again once the page is refreshed?
  • Security issues with PHP's Readfile method
  • Stop Bash Script if Hive Fails
  • d3 v4 drag and drop with TypeScript
  • JQuery Internet Explorer and ajaxstop
  • D3 nodes and links from JSON with nested arrays of children
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • How can I use Kendo UI with Razor?
  • How to format a variable of double type
  • Matrix multiplication with MKL
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • File not found error Google Drive API
  • Linking SubReports Without LinkChild/LinkMaster
  • How can I remove ASP.NET Designer.cs files?
  • Converting MP3 duration time