Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: django013 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):
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.
-
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
-
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.
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
-
Why not post a script that dont work ;-)
DazTheGas
-
well - I decided to try a completely different approach, but for that I first have to learn more about it.