Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: TimGS on June 01, 2015, 11:13:43 PM

Title: Lua Sizer Confusion tying Sizer to Panel
Post by: TimGS on June 01, 2015, 11:13:43 PM
I am trying to understand Sizers so I can create my own screens and place things where I want them.  I tried to tie the Sizer to the Panel not the Frame; Can someone please explain what I did wrong???  Sounds like a problem Papa Bear could handle  ;D

Code: [Select]
--Basic Empty Wizard
local frame = nil
local panel = nil
local inst = mc.mcGetInstance(mInst);

--Function sed to create widget ids
function GetNextID()
    m_id = m_id+1;
    return m_id;
end


function main()

    -- create the wxFrame window
    if (mcLuaPanelParent == nil) then
        frame = wx.wxFrame( wx.NULL,              -- no parent for toplevel windows
                            wx.wxID_ANY,          -- wxWindow ID not require
                            "wxLua Basic Window", -- Frame Title
                            wx.wxDefaultPosition, -- let system place the frame
                            wx.wxDefaultSize,     -- default frame size
                            wx.wxDEFAULT_FRAME_STYLE ) -- Use default frame style
       
        -- create a single child window, wxWidgets will set the size to fill frame
        panel = wx.wxPanel(frame, wx.wxID_ANY)

        -- create a simple file menu
        fileMenu = wx.wxMenu()
        fileMenu:Append(wx.wxID_EXIT, "&Exit", "Quit the program")

        -- create a simple help menu
        helpMenu = wx.wxMenu()
        helpMenu:Append(wx.wxID_ABOUT, "&About", "What is the version of wxLua and wx.widgets")

        -- create a menu bar and append the file and help menus
        menuBar = wx.wxMenuBar()
        menuBar:Append(fileMenu, "&File")
        menuBar:Append(helpMenu, "&Help")

        -- attach the menu bar into the frame
        frame:SetMenuBar(menuBar)

        -- create a simple status bar
        frame:CreateStatusBar(1)
        frame:SetStatusText("Hello World")

        -- connect the selection event of the exit menu item to an
        -- event handler that closes the window
        frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED,
                      function (event) frame:Close(true) end )

        -- connect the selection event of the about menu item
        frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED,
            function (event)
                wx.wxMessageBox('Your are currently running '..
                                wxlua.wxLUA_VERSION_STRING..'\n built with '..wx.wxVERSION_STRING,
                                'About wxLua Basic Window',
                                wx.wxOK + wx.wxICON_INFORMATION,
                                frame)
            end )

        -- show the frame window
        frame:Show(true)
    else
        panel = mcLuaPanelParent
local window = panel:GetParent();
local wsize = window:GetSize();
panel:SetSize(wsize);
        panel:Connect( wx.wxEVT_CLOSE_WINDOW,
function (event)                 
event:Skip();
end
);
    end

-----------------------------------------------------------------------
    mainSizer = wx.wxBoxSizer(wx.wxVERTICAL);
    panel:SetBackgroundColour(wx.wxColour(0,255,128));
    local st1 = wx.wxStaticText( panel, wx.wxID_ANY, "Text 1");
    local st2 = wx.wxStaticText( panel, wx.wxID_ANY, "Text 2");
    local st3 = wx.wxStaticText( panel, wx.wxID_ANY, "Text 3");
    local st4 = wx.wxStaticText( panel, wx.wxID_ANY, "Text 4");
    local st5 = wx.wxStaticText( panel, wx.wxID_ANY, "Text 5");
    local st6 = wx.wxStaticText( panel, wx.wxID_ANY, "Text 6");
    Sizer = wx.wxFlexGridSizer( 2, 3, 0, 30 );--1 rows, 3 columns, no x/y spacing between
    Sizer:Add(st1, 1);
    Sizer:Add(st2, 1);
    Sizer:Add(st3, 1);
    Sizer:Add(st4, 1);
    Sizer:Add(st5, 1);
    Sizer:Add(st6, 1);
    -- Set up the frame to use that sizer to move/resize its children controls
    mainSizer:Add(Sizer, 0, wx.wxALIGN_LEFT+wx.wxRIGHT, 20);
    frame:SetSizer(mainSizer);  --This works????
 --   panel:SetSizer(mainSizer); --Does not work, everything is stacked.

-----------------------------------------------------------------------

end
main();

Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: Screwie Louie on June 02, 2015, 12:22:26 AM
I just took a look at wx.FormBuilder and wizards and lua panels and bears oh my!; yesterday. Yep. I'm down to about 3 hours of sleep per night now, and my girlfriend gets pissed at me when I jump outta bed at 8am just to program and play with the mill. Haha! So the whole putting DRO overlays on top of the tool path generator idea didn't work out so great for me...which led me to dig deeper. From a snapshot, most of the code is about autosizing and basic functions. After a bit it should become all familiar like anything and best of all the windows can be templated. Poppabear posted in the tookit a template for frames and panels that eliminate the 3d boarder and establish a template like I am talking about. But hey, take my opinion with a grain of salt. I just glanced at it. Speaking of the toolbox...man, there is some great stuff going on in there! After looking at the dates, I feel like I'm late for the party :o)

--josh
Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: dude1 on June 02, 2015, 12:58:30 AM
don't ya girl friend know shes ya mistress the mill`s the wife
Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: Screwie Louie on June 02, 2015, 01:16:43 AM
lmao, that was perfect!
Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: TimGS on June 02, 2015, 07:10:25 AM
I started with the templates and they did not work the way I expected.  Just trying to gain understanding.

...ps...I will have to tell that one to my "Mistress" :D
Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: TimGS on June 02, 2015, 08:02:52 AM
I added the "panel:Fit() and the code started to work like the example...still don't understand...  I need to do a little more research into widgets :D

Added a static text frame too... Hope this helps someone ;)

Code: [Select]
--Basic Empty Wizard
local frame = nil
local panel = nil
local inst = mc.mcGetInstance(mInst);

--Function sed to create widget ids
function GetNextID()
    m_id = m_id+1;
    return m_id;
end


function main()

    -- create the wxFrame window
    if (mcLuaPanelParent == nil) then
        frame = wx.wxFrame( wx.NULL,              -- no parent for toplevel windows
                            wx.wxID_ANY,          -- wxWindow ID not require
                            "wxLua Basic Window", -- Frame Title
                            wx.wxDefaultPosition, -- let system place the frame
                            wx.wxDefaultSize,     -- default frame size
                            wx.wxDEFAULT_FRAME_STYLE ) -- Use default frame style
       
        -- create a single child window, wxWidgets will set the size to fill frame
        panel = wx.wxPanel(frame, wx.wxID_ANY)

        -- create a simple file menu
        fileMenu = wx.wxMenu()
        fileMenu:Append(wx.wxID_EXIT, "&Exit", "Quit the program")

        -- create a simple help menu
        helpMenu = wx.wxMenu()
        helpMenu:Append(wx.wxID_ABOUT, "&About", "What is the version of wxLua and wx.widgets")

        -- create a menu bar and append the file and help menus
        menuBar = wx.wxMenuBar()
        menuBar:Append(fileMenu, "&File")
        menuBar:Append(helpMenu, "&Help")

        -- attach the menu bar into the frame
        frame:SetMenuBar(menuBar)

        -- create a simple status bar
        frame:CreateStatusBar(1)
        frame:SetStatusText("Hello World")

        -- connect the selection event of the exit menu item to an
        -- event handler that closes the window
        frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED,
                      function (event) frame:Close(true) end )

        -- connect the selection event of the about menu item
        frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED,
            function (event)
                wx.wxMessageBox('Your are currently running '..
                                wxlua.wxLUA_VERSION_STRING..'\n built with '..wx.wxVERSION_STRING,
                                'About wxLua Basic Window',
                                wx.wxOK + wx.wxICON_INFORMATION,
                                frame)
            end )

        -- show the frame window
        frame:Show(true)
    else
        panel = mcLuaPanelParent
local window = panel:GetParent();
local wsize = window:GetSize();
panel:SetSize(wsize);
        panel:Connect( wx.wxEVT_CLOSE_WINDOW,
function (event)                 
event:Skip();
end
);
    end

-----------------------------------------------------------------------
    mainSizer = wx.wxStaticBoxSizer(wx.wxVERTICAL, panel, "MainSizer");
    panel:SetBackgroundColour(wx.wxColour(0,255,128)); --default Mach4 230,230,230
    local st1 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 1");
    local st2 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 2");
    local st3 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 3");
    local st4 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 4");
    local st5 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 5");
    local st6 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 6");
    Sizer = wx.wxFlexGridSizer( 2, 3, 0, 30 );--1 rows, 3 columns, no x/y spacing between
    Sizer:Add(st1, 1);
    Sizer:Add(st2, 1);
    Sizer:Add(st3, 1);
    Sizer:Add(st4, 1);
    Sizer:Add(st5, 1);
    Sizer:Add(st6, 1);
    local st21 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 1");
    local st22 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 2");
    local st23 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 3");
    local st24 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 4");
    local st25 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 5");
    local st26 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 6");
    Sizer2 = wx.wxFlexGridSizer( 2, 3, 0, 30 );--1 rows, 3 columns, no x/y spacing between
    Sizer2:Add(st21, 1);
    Sizer2:Add(st22, 1);
    Sizer2:Add(st23, 1);
    Sizer2:Add(st24, 1);
    Sizer2:Add(st25, 1);
    Sizer2:Add(st26, 1);
    -- Set up the frame to use that sizer to move/resize its children controls
    mainSizer:Add(Sizer, 0, wx.wxALIGN_LEFT+wx.wxRIGHT, 20);
    mainSizer:Add(Sizer2, 0, wx.wxALIGN_LEFT+wx.wxRIGHT, 20);
    --frame:SetSizer(mainSizer);  --This no longer works after adding panel:Fit()
    panel:SetSizer(mainSizer); --Works Now because of the panel:Fit() added next...don't know why yet.
    panel:Fit();

-----------------------------------------------------------------------

end
main();

Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: TimGS on June 02, 2015, 08:16:01 AM
This one might help someone someday too...
Code: [Select]
--Basic Empty Wizard
local frame = nil
local panel = nil
local inst = mc.mcGetInstance(mInst);

--Function sed to create widget ids
function GetNextID()
    m_id = m_id+1;
    return m_id;
end


function main()

    -- create the wxFrame window
    if (mcLuaPanelParent == nil) then
        frame = wx.wxFrame( wx.NULL,              -- no parent for toplevel windows
                            wx.wxID_ANY,          -- wxWindow ID not require
                            "wxLua Basic Window", -- Frame Title
                            wx.wxDefaultPosition, -- let system place the frame
                            wx.wxDefaultSize,     -- default frame size
                            wx.wxDEFAULT_FRAME_STYLE ) -- Use default frame style
       
        -- create a single child window, wxWidgets will set the size to fill frame
        panel = wx.wxPanel(frame, wx.wxID_ANY)

        -- create a simple file menu
        fileMenu = wx.wxMenu()
        fileMenu:Append(wx.wxID_EXIT, "&Exit", "Quit the program")

        -- create a simple help menu
        helpMenu = wx.wxMenu()
        helpMenu:Append(wx.wxID_ABOUT, "&About", "What is the version of wxLua and wx.widgets")

        -- create a menu bar and append the file and help menus
        menuBar = wx.wxMenuBar()
        menuBar:Append(fileMenu, "&File")
        menuBar:Append(helpMenu, "&Help")

        -- attach the menu bar into the frame
        frame:SetMenuBar(menuBar)

        -- create a simple status bar
        frame:CreateStatusBar(1)
        frame:SetStatusText("Hello World")

        -- connect the selection event of the exit menu item to an
        -- event handler that closes the window
        frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED,
                      function (event) frame:Close(true) end )

        -- connect the selection event of the about menu item
        frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED,
            function (event)
                wx.wxMessageBox('Your are currently running '..
                                wxlua.wxLUA_VERSION_STRING..'\n built with '..wx.wxVERSION_STRING,
                                'About wxLua Basic Window',
                                wx.wxOK + wx.wxICON_INFORMATION,
                                frame)
            end )

        -- show the frame window
        frame:Show(true)
    else
        panel = mcLuaPanelParent
local window = panel:GetParent();
local wsize = window:GetSize();
panel:SetSize(wsize);
        panel:Connect( wx.wxEVT_CLOSE_WINDOW,
function (event)                 
event:Skip();
end
);
    end

-----------------------------------------------------------------------
    mainSizer = wx.wxStaticBoxSizer(wx.wxVERTICAL, panel, "MainSizer");
    SubSizer1 = wx.wxStaticBoxSizer(wx.wxVERTICAL, panel, "SubSizer1");
    SubSizer2 = wx.wxStaticBoxSizer(wx.wxVERTICAL, panel, "SubSizer2");
    panel:SetBackgroundColour(wx.wxColour(0,255,128)); --default Mach4 230,230,230
    local st1 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 1");
    local st2 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 2");
    local st3 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 3");
    local st4 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 4");
    local st5 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 5");
    local st6 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 6");
    Sizer = wx.wxFlexGridSizer( 2, 3, 0, 30 );--1 rows, 3 columns, no x/y spacing between
    Sizer:Add(st1, 1);
    Sizer:Add(st2, 1);
    Sizer:Add(st3, 1);
    Sizer:Add(st4, 1);
    Sizer:Add(st5, 1);
    Sizer:Add(st6, 1);
    local st21 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 1");
    local st22 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 2");
    local st23 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 3");
    local st24 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 4");
    local st25 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 5");
    local st26 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 6");
    Sizer2 = wx.wxFlexGridSizer( 2, 3, 0, 30 );--1 rows, 3 columns, no x/y spacing between
    Sizer2:Add(st21, 1);
    Sizer2:Add(st22, 1);
    Sizer2:Add(st23, 1);
    Sizer2:Add(st24, 1);
    Sizer2:Add(st25, 1);
    Sizer2:Add(st26, 1);
    -- Set up the frame to use that sizer to move/resize its children controls
    SubSizer1:Add(Sizer, 0, wx.wxALIGN_LEFT+wx.wxRIGHT, 20);
    SubSizer2:Add(Sizer2, 0, wx.wxALIGN_LEFT+wx.wxRIGHT, 20);
    mainSizer:Add(SubSizer1, 0, wx.wxALIGN_CENTER, 20);
    mainSizer:Add(SubSizer2, 0, wx.wxALIGN_LEFT+wx.wxRIGHT, 20);
   --frame:SetSizer(mainSizer);  --This no longer works after adding panel:Fit()
    panel:SetSizer(mainSizer); --Works Now because of the panel:Fit() added next...don't know why yet.
    panel:Fit();

-----------------------------------------------------------------------

end
main();


Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: poppabear on June 02, 2015, 09:21:25 AM
Here, look at this code, it fixes your Frame and Panel issues, plus it aliens your sizer1 & 2.

Look toward the bottom for how to do the Panel/Frame fix. It will now run in a frame or a panel on your screen set

Code: [Select]
--Basic Empty Wizard
local frame = nil
local panel = nil
local inst = mc.mcGetInstance(mInst);

--Function sed to create widget ids
function GetNextID()
    m_id = m_id+1;
    return m_id;
end


function main()

    -- create the wxFrame window
    if (mcLuaPanelParent == nil) then
        frame = wx.wxFrame( wx.NULL,              -- no parent for toplevel windows
                            wx.wxID_ANY,          -- wxWindow ID not require
                            "wxLua Basic Window", -- Frame Title
                            wx.wxDefaultPosition, -- let system place the frame
                            wx.wxDefaultSize,     -- default frame size
                            wx.wxDEFAULT_FRAME_STYLE ) -- Use default frame style
       
        -- create a single child window, wxWidgets will set the size to fill frame
        panel = wx.wxPanel(frame, wx.wxID_ANY)

        -- create a simple file menu
        fileMenu = wx.wxMenu()
        fileMenu:Append(wx.wxID_EXIT, "&Exit", "Quit the program")

        -- create a simple help menu
        helpMenu = wx.wxMenu()
        helpMenu:Append(wx.wxID_ABOUT, "&About", "What is the version of wxLua and wx.widgets")

        -- create a menu bar and append the file and help menus
        menuBar = wx.wxMenuBar()
        menuBar:Append(fileMenu, "&File")
        menuBar:Append(helpMenu, "&Help")

        -- attach the menu bar into the frame
        frame:SetMenuBar(menuBar)

        -- create a simple status bar
        frame:CreateStatusBar(1)
        frame:SetStatusText("Hello World")

        -- connect the selection event of the exit menu item to an
        -- event handler that closes the window
        frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED,
                      function (event) frame:Close(true) end )

        -- connect the selection event of the about menu item
        frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED,
            function (event)
                wx.wxMessageBox('Your are currently running '..
                                wxlua.wxLUA_VERSION_STRING..'\n built with '..wx.wxVERSION_STRING,
                                'About wxLua Basic Window',
                                wx.wxOK + wx.wxICON_INFORMATION,
                                frame)
            end )

        -- show the frame window
        frame:Show(true)
    else
        panel = mcLuaPanelParent
local window = panel:GetParent();
local wsize = window:GetSize();
panel:SetSize(wsize);
        panel:Connect( wx.wxEVT_CLOSE_WINDOW,
function (event)                 
event:Skip();
end
);
    end

-----------------------------------------------------------------------
    mainSizer = wx.wxStaticBoxSizer(wx.wxVERTICAL, panel, "MainSizer");
    SubSizer1 = wx.wxStaticBoxSizer(wx.wxVERTICAL, panel, "SubSizer1");
    SubSizer2 = wx.wxStaticBoxSizer(wx.wxVERTICAL, panel, "SubSizer2");
    panel:SetBackgroundColour(wx.wxColour(0,255,128)); --default Mach4 230,230,230
    local st1 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 1");
    local st2 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 2");
    local st3 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 3");
    local st4 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 4");
    local st5 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 5");
    local st6 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer1 Text 6");
    Sizer = wx.wxFlexGridSizer( 2, 3, 0, 30 );--1 rows, 3 columns, no x/y spacing between
    Sizer:Add(st1, 1);
    Sizer:Add(st2, 1);
    Sizer:Add(st3, 1);
    Sizer:Add(st4, 1);
    Sizer:Add(st5, 1);
    Sizer:Add(st6, 1);
    local st21 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 1");
    local st22 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 2");
    local st23 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 3");
    local st24 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 4");
    local st25 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 5");
    local st26 = wx.wxStaticText( panel, wx.wxID_ANY, "Sizer2 Text 6");
    Sizer2 = wx.wxFlexGridSizer( 2, 3, 0, 30 );--1 rows, 3 columns, no x/y spacing between
    Sizer2:Add(st21, 1);
    Sizer2:Add(st22, 1);
    Sizer2:Add(st23, 1);
    Sizer2:Add(st24, 1);
    Sizer2:Add(st25, 1);
    Sizer2:Add(st26, 1);
    -- Set up the frame to use that sizer to move/resize its children controls
    SubSizer1:Add(Sizer, 0, wx.wxALIGN_LEFT+wx.wxRIGHT, 20);
    SubSizer2:Add(Sizer2, 0, wx.wxALIGN_LEFT+wx.wxRIGHT, 20);
    mainSizer:Add(SubSizer1, 0, wx.wxALIGN_CENTER, 20);
    mainSizer:Add(SubSizer2, 0, wx.wxALIGN_CENTER, 20);--changed this to alien them both in center
    panel:SetSizer(mainSizer);  --this belongs here
    panel:Fit();--this belongs here
-------------------------------------------------Add the below if/else statement
    if(mcLuaPanelParent == nil) then             
        frame:Fit();
        frame:Show(true);       
    else
        local window = panel:GetParent();
        window:Connect( wx.wxID_ANY, wx.wxEVT_SIZE,
                        function(event)
                            local wsize = event:GetSize();
                            panel:SetSize(wsize);
                            panel:FitInside();
                        end);
    end
-----------------------------------------------------------------------
end
main();
wx.wxGetApp():MainLoop();

Scott
Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: poppabear on June 02, 2015, 09:30:56 AM
One other thing, even though "wxFormBuilder" is a great tool for making wxLua apps, you really don't learn anything your self.
Even though it SUCKS...... take the time to learn to use/build "Frames" your self from the template or bolt hole wizard. Play with the various functions and sizers so you can understand what they are doing. Yes, you can learn A LOT from wxFormBuilder for the how, but not the why....

In the "Tool Box" there is a "Controls Example" take a look at that, it covers most of the common objects that you will probably use on a Wizard Frame. Play with it, change it, see what happens. Make SMALL changes here and there to see what this or that does when you do so.

I am not saying it is the ONLY way or Best way, just a way.

Scott

Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: TimGS on June 02, 2015, 02:52:40 PM
I am not using wxFormBuilder just grabbing snippets, making small changes and seeing what is happens to the screen.  I started with the "Tool Box" and played with the controls then moved on to just trying to place things on the screen.  Now I have a basic display ... see image...  Now I am trying to use the radio buttons to update the images.  I will work on that tonight.  The next step is to tie signal events to update the graphics and the radio buttons.

...The reason I had one box centered and one left aligned was to show me what difference wxALIGN_CENTER vs wxALIGN_RIGHT vs wxALIGN_LEFT....the answer is it depends on what panel/frame/sizer the sizer is in.  ;D

wx.widgets aren't easy .... still looking at methods for flipping graphics.  ... currently all graphics for one switch stored in an array.
Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: TimGS on June 02, 2015, 02:59:08 PM
You might have noticed that my code is still littered with local "dems" and "reps".... I wonder where that came from  ;D
Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: smurph on June 02, 2015, 05:16:00 PM
Once you get used to sizers, you will wonder why that has not been the way to do it from the beginning of time.  Yeah, there is a learning curve.  And some things are not possible.  Overlapping controls, for example.  However, you can still do that by NOT using sizers.  You can set the control positions manually if you want to.  But it is hardly worth the effort.  Sizers make expanding/aligning the controls with the parent window much easier just by laying out the sizers in a manner that does what you want.  Eventually, you will know how to get what you want and it becomes second nature.  And not using overlapping controls is a small price to pay for that.  You just have to change how you lay out the window in most cases.

As you mentioned, wxFormBuilder now includes support for generating LUA code.  I have not tried it, but it is nice to see that they did that.  But using a tool like that can certainly help you visualize how to work with sizers.  Generate a form and put some sizers on it and see what the code looks like.  I think that would be pretty awesome.  I'll have to play with it if I have time.

Steve
Title: Re: Lua Sizer Confusion tying Sizer to Panel
Post by: TimGS on June 02, 2015, 05:19:46 PM
Thank You all for the advise and help... :D