Hello Guest it is September 21, 2019, 03:37:49 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - smurph

101
Mach4 General Discussion / Re: Un-Supported wxNumberEntryDialog
« on: January 27, 2019, 12:33:17 PM »
Wow!  Nice catch Daz.

I guess one could do

True = true
False = false

At the top of the code. 

Steve

102
Mach4 General Discussion / Re: Un-Supported wxNumberEntryDialog
« on: January 26, 2019, 07:30:33 PM »
Ha!  I'm NEVER right, according to wifey.  But that's ok.  :) 

103
Mach4 General Discussion / Re: Un-Supported wxNumberEntryDialog
« on: January 26, 2019, 06:03:44 PM »
Did you use a frame or a dialog?  For a dialog, you use

rc = UI.<your dialog variable name>:ShowModal()

For a frame:

UI.<your frame variable name>:Show()

Code: [Select]
----------------------------------------------------------------------------
-- Lua code generated with wxFormBuilder (version Aug  8 2018)
-- http://www.wxformbuilder.org/
----------------------------------------------------------------------------

-- Load the wxLua module, does nothing if running from wxLua, wxLuaFreeze, or wxLuaEdit
package.cpath = package.cpath..";./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;"
require("wx")

UI = {}


-- create MyDialog1
UI.MyDialog1 = wx.wxDialog (wx.NULL, wx.wxID_ANY, "", wx.wxDefaultPosition, wx.wxSize( 226,133 ), wx.wxDEFAULT_DIALOG_STYLE )
UI.MyDialog1:SetSizeHints( wx.wxDefaultSize, wx.wxDefaultSize )

UI.bSizer1 = wx.wxBoxSizer( wx.wxVERTICAL )

UI.bSizer2 = wx.wxBoxSizer( wx.wxHORIZONTAL )

UI.m_staticText1 = wx.wxStaticText( UI.MyDialog1, wx.wxID_ANY, "Steve:", wx.wxDefaultPosition, wx.wxDefaultSize, 0 )
UI.m_staticText1:Wrap( -1 )

UI.bSizer2:Add( UI.m_staticText1, 0, wx.wxALL, 2 )

UI.m_textCtrl1 = wx.wxTextCtrl( UI.MyDialog1, wx.wxID_ANY, "", wx.wxDefaultPosition, wx.wxDefaultSize, 0 )
UI.bSizer2:Add( UI.m_textCtrl1, 1, wx.wxALL, 2 )


UI.bSizer1:Add( UI.bSizer2, 1, wx.wxEXPAND, 5 )

UI.m_sdbSizer1 = wx.wxStdDialogButtonSizer()
UI.m_sdbSizer1OK = wx.wxButton( UI.MyDialog1, wx.wxID_OK, "" )
UI.m_sdbSizer1:AddButton( UI.m_sdbSizer1OK )
UI.m_sdbSizer1Cancel = wx.wxButton( UI.MyDialog1, wx.wxID_CANCEL, "" )
UI.m_sdbSizer1:AddButton( UI.m_sdbSizer1Cancel )
UI.m_sdbSizer1:Realize();

UI.bSizer1:Add( UI.m_sdbSizer1, 1, wx.wxEXPAND, 5 )


UI.MyDialog1:SetSizer( UI.bSizer1 )
UI.MyDialog1:Layout()

UI.MyDialog1:Centre( wx.wxBOTH )

-- Connect Events

UI.m_sdbSizer1Cancel:Connect( wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event)
--implements m_Cancel()

event:Skip()
end )

UI.m_sdbSizer1OK:Connect( wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event)
--implements m_OnOk

event:Skip()
end )

--wx.wxGetApp():MainLoop()

To show the above dialog code:

rc = UI.MyDialog1:ShowModal()

rc will be wx.wxID_OK or wx.wxID_CANCEL, depending on what button was pressed.

The frame's Show() method isn't modal, as it is a top level window.  Frame and dialogs each have their pros and cons.

Steve

104
Mach4 General Discussion / Re: Un-Supported wxNumberEntryDialog
« on: January 22, 2019, 04:10:37 AM »
Nah...  you guys are making too much of the generated code.  Why?  Because you don't know the paradigm that wxFormBuilder is using.  Once you understand that, it becomes a tool to help you work smarter, not harder.  :)  Anyway, I was talking to Brett and he said he might do a video on how to make something useful with wxFormBuilder.  It is one of those things that is hard to explain but easy to show.  And when you get past that, the generated code will actually teach you what is doing what by example. 

Not say you HAVE to.  But I'm just thinking you guys would be REALLY dangerous :) and have fun with it at some point. 

Steve

105
Mach4 General Discussion / Re: Un-Supported wxNumberEntryDialog
« on: January 21, 2019, 03:11:36 PM »
But sizers rule!!!  That was the greatest invention since beer cans.  They can be a bit confusing at first.  But once you get them, you'll wonder how the world got along without them in the past. 

Steve

106
Mach4 General Discussion / Re: Un-Supported wxNumberEntryDialog
« on: January 21, 2019, 12:54:39 AM »
It isn't necessary.  But I would say it is desirable.  Because if you can't use the stock "data grabber" dialogs and require something juuuuust a bit more complex, the wxFormbuilder thing pays big dividends.   Otherwise, you start to have to know MORE about wxWidgets to code a dialog by hand. 

Maybe someone can do a video on how to work with wxFormBuilder.

Steve

107
Mach4 General Discussion / Re: Un-Supported wxNumberEntryDialog
« on: January 20, 2019, 09:28:10 PM »
We usually do a show called Cabin Fever (this weekend, in fact) in PA.  But the weather prevented most of us from going.  Besides that, we do IMTS and FabTech every now and then.

I LOVED doing the Cabin Fever show when it was in March and in York, PA.  Now it is back (original time anyway) in January and in Lebanon, PA.  :(  I haven't been too excited about the Jan/Lebanon combination. 

Steve

108
Mach4 General Discussion / Re: Un-Supported wxNumberEntryDialog
« on: January 20, 2019, 07:46:31 PM »
I miss the Digital Machinist shows.  :( 

The wxFormbuilder stuff isn't that hard once you realize that it puts all of the GUI code in one table called UI (I guess for User Interface).  You just paste all of that generated code into your LUA file and call it, basically.

Steve

109
Mach4 General Discussion / Re: Un-Supported wxNumberEntryDialog
« on: January 20, 2019, 03:23:17 PM »
Just use a text entry and convert the text to a real with tonumber().

One thing that you guys may not know is wxFormBuilder generates code for wxLua.  Just build you own dialog in wxFormBuilder and do what ever you need.  There will be a learning curve, but it is worth it. 

Steve

110
Mach4 General Discussion / Re: Plasma table - Dry Run feature in M3 macro
« on: January 19, 2019, 04:35:29 AM »
Craig!  I couldn't have said it any better.  In fact, I might not have said it as good!  :)

Steve