Hello Guest it is January 28, 2020, 09:32:13 AM

Author Topic: replacement for mcLuaPanelParent ?  (Read 855 times)

0 Members and 1 Guest are viewing this topic.

replacement for mcLuaPanelParent ?
« on: June 02, 2017, 12:35:00 AM »
Hi,

I start the lua panels with createUI(mcLuaPanelParent) after loading the panel code.
That works fine for runtime, but is of no help in debug sessions, as in debug mode mcLuaPanelParent is not existant.

In the samples they create a dialog frame in case mcLuaPanelParent is null, but I think, that is not apropriate.
In mach4 a luaPanel will most likely have no frame as parent, but another wxControl ...
So what could be used in screen-designer-debug-mode?

Inside createUI mcLuaPanelParent is used like this (as parameter called panel):
Code: [Select]
local window = panel:GetParent()
local wsize = window:GetSize()

panel:SetSize(wsize)

...

as I found out, at control creation time mcLuaPanelParent has no size, so the startup code does not lead to the desired size.
So a resize handler has to be established.

Offline DazTheGas

*
  •  752 752
  • DazTheGas
    • View Profile
Re: replacement for mcLuaPanelParent ?
« Reply #1 on: June 02, 2017, 02:58:20 AM »
Mach4 Gui is created using C++. mcLuaPanelParent gets the Parent Handle of the Lua Panel enableing better control of its styles etc, this cannot exist in editor mode as it gets created on exiting the editor or starting mach4. There are many ways to debug such panels like using the same princible of macros.

if (mc.mcInEditor() == 1) then
   Panel = create a dummy window/panel for debug
else
   Panel = mcLuaPanelParent
end
Rest of code........

Another thing to note is Lua Panels do not get refreshed when quiting the editor so as a quick work around you can exit the editor then from the view menu reload you screenset.
Before I created my current screen I used the lua panels for everything buttons/dro`s etc and found there was so much more you could achieve than using the conventional buttons/dro`s

DazTheGas
Theres always time for a choccy biccy
Re: replacement for mcLuaPanelParent ?
« Reply #2 on: June 02, 2017, 03:08:27 AM »
Hi,

I already have a test-environment for wxWindows outside of mach4.
The problem is, that code runs fine in my test-environment but fails inside of mach4.
So creating a dummy panel with a dialog frame around does not change anything. Things work inside that dummy frame, but fail when mach4 runs.

Therefore I'm looking for a test-environment, that is closer to mach4 ...

The refresh-Problem is already known. I do as recommended and restart mach4 as soon as I leave edit mode.

Quote
Before I created my current screen I used the lua panels for everything buttons/dro`s etc and found there was so much more you could achieve than using the conventional buttons/dro`s
Well, based on the ultimate infos from smurph I have to rethink my plans about using lua-panels.
Sure you have more freedom on creating UI-stuff, but if there's no way to exchange data beside using registers ...

Reinhard

Offline DazTheGas

*
  •  752 752
  • DazTheGas
    • View Profile
Re: replacement for mcLuaPanelParent ?
« Reply #3 on: June 02, 2017, 07:58:16 AM »
Why not post a script that dont work ;-)

DazTheGas
Theres always time for a choccy biccy
Re: replacement for mcLuaPanelParent ?
« Reply #4 on: June 03, 2017, 12:03:36 AM »
well - I decided to try a completely different approach, but for that I first have to learn more about it.