Hello Guest it is April 28, 2024, 11:24:13 PM

Author Topic: Edit Screen - Mutli-line textbox, label with scrollbar or table control?  (Read 1259 times)

0 Members and 1 Guest are viewing this topic.

We are customizing Mach4 to act partially as a data acquisition tool, and I am trying to display the contents of a Lua table on the screen. The table comprises several axis values, as well as a probe reading (that comes over Modbus), and might end up being 100+ "rows" long. In the screen editor I want to display this table in a control, but unfortunately it looks like none of the controls have the ability to display a 2D table very well.

Textboxes don't seem to natively support multi-line capability like it does in most languages (I am a C# software engineer). Maybe this can be done through a Lua script? I'm not familiar enough with the namespaces in Lua to know where to start, however.

Labels support multi-line, but do not have scroll bars if the contents extend beyond the bottom bounds of the label. Again, available through Lua?

There is no table control (aside from tool table, which is not very customizable).

Anyone know how to do any of the above? Add a scroll bar to a multi-line textbox, or maybe to a tab that contains a label that extends beyond the lower bounds of the tab control? Or just add a simple table/grid?
« Last Edit: February 02, 2022, 11:01:08 AM by mb-ABTech »
Re: Edit Screen - Mutli-line textbox, label with scrollbar or table control?
« Reply #1 on: February 02, 2022, 06:39:40 PM »
Hi,
I rather think that requirement is outside of what Mach offers natively, but Mach itself offers only the very briefest subset of wx.Widgets.
I suspect what you want is eminentlty doable, try wxFormBuilder.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Edit Screen - Mutli-line textbox, label with scrollbar or table control?
« Reply #2 on: February 10, 2022, 01:40:16 PM »
I figured out how to add new windows with all the controls I am looking for, but if possible I would really like to add a multiline textbox to the "main" screen.

Does anyone know if there is function in the API that lets you get the resizers in the main screen? I couldn't find any function in the "scr" namespace that suits my needs, and asking for parent controls from existing controls never gives a reference to the sizer, just to the parent control (from what I can see the sizer is what is used to add controls). For instance asking for the parent for a textbox in a tab, the returned control is the tab page (wxNotebookPage), not the resizer.

I went through the API guide, but it only contains "mc" namespace functions, it doesn't even reference "scr" functions.

It almost seems like Mach4 specifically tries to encapsulate the front end so that scripts have limited or no access to the underlying controls.
Re: Edit Screen - Mutli-line textbox, label with scrollbar or table control?
« Reply #3 on: February 10, 2022, 02:15:43 PM »
Hi,

Quote
I went through the API guide, but it only contains "mc" namespace functions, it doesn't even reference "scr" functions.

The API is almost entirely .mc namespace, the .scr namespace was really used during development only and was never intended for widespread user use.
You will find what little I can find here:

https://www.machsupport.com/forum/index.php?topic=40051.0

Really you are barking up the wrong tree here though....there is a perfectly excellent suite of graphic commands to do as you require in the form of wx.Widgets which
is fully supported by Lua and Mach. All of those functions have the namespace .wx. You need to make yourself familiar with them. Crafting .wx code is facilitated by wxFormBuilder.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Edit Screen - Mutli-line textbox, label with scrollbar or table control?
« Reply #4 on: February 10, 2022, 02:19:24 PM »
Like I said I was able to figure out how to create a separate window with all the necessary controls, but I was hoping to have all the information self contained in the main screen, not in separate windows.

After investigating this more it seems like there is simply no way to programmatically add custom controls to the main screen (i.e. get a reference to any of the main screen controls). Unfortunate, but I guess I'll have to just use custom windows.
« Last Edit: February 10, 2022, 02:22:36 PM by mb-ABTech »
Re: Edit Screen - Mutli-line textbox, label with scrollbar or table control?
« Reply #5 on: February 10, 2022, 02:37:40 PM »
Hi,
Mach4 is a CNC program. Onscreen graphics is NOT the central theme here. That Mach4 offers a very comprehensive suite of graphics tools courtesy of
wxWidgets is very nice, and a major advance over Mach3 and in fact any other Windows based CNC solutions, it is just that....nice.

What I really care about is Mach's ability to control my machine, is the trajectory planner second order or third order?, how is the CV feature calculated? and how can you optimise CV
to your situation?,when can we expect multiple instances of Mach, what will be the comms between instances?....these are the important things. On-screen graphics are just icing on the cake...no more.

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

Offline jbuehn

*
  •  101 101
    • View Profile
Re: Edit Screen - Mutli-line textbox, label with scrollbar or table control?
« Reply #6 on: February 10, 2022, 03:03:37 PM »
Quote
Like I said I was able to figure out how to create a separate window with all the necessary controls, but I was hoping to have all the information self contained in the main screen, not in separate windows.

Are you using a Lua panel (in the screen editor) for your custom controls? You can basically use any wxLua elements on the main screen if it's in a panel.
Re: Edit Screen - Mutli-line textbox, label with scrollbar or table control?
« Reply #7 on: February 10, 2022, 03:10:52 PM »
Quote
Like I said I was able to figure out how to create a separate window with all the necessary controls, but I was hoping to have all the information self contained in the main screen, not in separate windows.

Are you using a Lua panel (in the screen editor) for your custom controls? You can basically use any wxLua elements on the main screen if it's in a panel.

How do you get a control reference from the main screen? scr doesn't seem to provide that functionality, it only returns strings.
Re: Edit Screen - Mutli-line textbox, label with scrollbar or table control?
« Reply #8 on: February 10, 2022, 04:02:24 PM »
Success!

Thank you jbuehn for pointing me in the right direction. I ended up using wx.wxFindWindowByName function to get the control reference, then it was only a matter of adding the panel with sizers and controls.

Offline jbuehn

*
  •  101 101
    • View Profile
Re: Edit Screen - Mutli-line textbox, label with scrollbar or table control?
« Reply #9 on: February 10, 2022, 04:08:31 PM »
If you look in C:\Mach4Hobby\Wizards\panelscript.mcs you'll see a reference to mcLuaPanelParent - which you can call GetParent() on.