Hello Guest it is April 24, 2024, 10:32:03 PM

Author Topic: wxLua functions  (Read 5318 times)

0 Members and 1 Guest are viewing this topic.

wxLua functions
« on: September 10, 2016, 09:54:08 PM »
Hi All,
just started to write scripts and so on....

Is there a list of available wx functions and syntax?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: wxLua functions
« Reply #1 on: September 10, 2016, 09:59:32 PM »
Hi All,
another quick question.

In the M4 API .chm there is syntax for C++ and LUA.

Can either or both be used in scripts?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: wxLua functions
« Reply #2 on: September 11, 2016, 03:50:11 AM »
The API.chm contains both purely as the script environment for mach4 is wxLua and the c++ is used when creating plugins.

Mach4 is not just wxLua, basic plain Lua can be used also.

Places I use a lot:

wxLua reference manual - http://wxlua.sourceforge.net/docs/wxluaref.html
wxLua user manual - http://wxlua.sourceforge.net/docs/wxlua.html
Lua reference manual - https://www.lua.org/manual/5.3/

apart from these you can also learn a lot by using the wxwidgets manual at http://docs.wxwidgets.org/3.0/


DazTheGas
New For 2022 - Instagram: dazthegas
Re: wxLua functions
« Reply #3 on: September 11, 2016, 05:28:48 AM »
Hi DTG,
thanks for your reply.

If I understand correctly plugins are C++ programs that interface with the Mach4 core
whereas Lua scripts are 'within' Mach4.

Looking at API.chm for example:
mcMotionCyclePlannerEx has C++ syntax but no Lua syntax therefore this function
is not available for scripting purposes?

In the little scripts I've written I've used wx.wxMessageBox("......") to signal progress
in Mach4. Simple, crude but effective.
Where I've come unstuck is trying to find equally simple functions to accept data from
a window. It seems I have to write some sort of 'forms' code and have yet to find
some code that I might copy to get an intro into the syntax and structure.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: wxLua functions
« Reply #4 on: September 11, 2016, 06:43:42 AM »
Quote
If I understand correctly plugins are C++ programs that interface with the Mach4 core
whereas Lua scripts are 'within' Mach4.

That is correct

One place you can look is the examples in the mach4 folder and the wizards or modules, most are left open source for you to look at or change. A good help is to google wxLua examples and get a copy of wxFormbuilder https://sourceforge.net/projects/wxformbuilder/

DazTheGas
New For 2022 - Instagram: dazthegas
Re: wxLua functions
« Reply #5 on: September 11, 2016, 07:19:32 AM »
Hi DTG,
again thanks for your help.

I have already viewed the three links, the wxLua users manual and the
reference manual are pure information overload at the moment.
The Lua 5.3 manual is somewhat more comprehensible but gives a
headache after a couple of hours.

I've downloaded wxFormbuilder and while I'm still floundering I can instantly
see the code which generates the frame/window/control or whatever, very
nifty and informative.

As a student did plenty of programming in Fortran and Basic and more
recently C for a servo drive controller. All of those are procedural languages,
this object oriented stuff has thrown right back to the beginning!

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: wxLua functions
« Reply #6 on: April 01, 2017, 04:28:08 PM »
I'm trying to build a simple button to generate some gcode from wxFormBuilder so I can make a turning wizard.  I can't seem to figure this out.  I have figured out how to use wxFormBuilder to add buttons.  Making a frame, a box sizer, and adding a button.  I generate the lua code but then I don't know how to open this form.  Can anyone help?
Chad Byrd

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: wxLua functions
« Reply #7 on: April 01, 2017, 04:37:10 PM »
Put the code in the wizards directory with the extension .mcs 
one thing missing from wxFormbuilder is it doesnt put the Show function at bottom of file so a simple frame should look like this

Code: [Select]
UI = {}

UI.MyFrame1 = wx.wxFrame (wx.NULL, wx.wxID_ANY, "", wx.wxDefaultPosition, wx.wxSize( 500,300 ), wx.wxDEFAULT_FRAME_STYLE+wx.wxTAB_TRAVERSAL )
UI.MyFrame1:SetSizeHints( wx.wxDefaultSize, wx.wxDefaultSize )


UI.MyFrame1:Centre( wx.wxBOTH )

UI.MyFrame1:Show() -- Missing from wxFormBuilder


You should now be able to open this from the wizards dialog.

DazTheGas
New For 2022 - Instagram: dazthegas
Re: wxLua functions
« Reply #8 on: April 01, 2017, 04:53:53 PM »
DTG,
Thanks!  That allowed me to open it in the wizards. 
If you don't mind, can you tell me how, or point me in the right direction, to editing the wxFormBuilder functions, My Dad has always used BorlandC++ to make programs, we can edit the background code right from Borland and then open the project from there.  This wxFormBuilder won't let me edit the Lua Code from the Lua Tab.  How do I edit the code to utilize the buttons and text boxes etc...?
-Chad
Chad Byrd

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: wxLua functions
« Reply #9 on: April 01, 2017, 05:08:56 PM »
Simply put you cant, hence the name "FormBuilder" wxLua is not built into it,  personally myself I tend to make what I require and copy the code into a file using notepad++ - add all functions etc.
If I make any changes to the wxFormBuilder project then I do a compare so I can copy and paste any changes.

DazTheGas
New For 2022 - Instagram: dazthegas