Hello Guest it is March 28, 2024, 11:05:58 AM

Author Topic: Disable button unless Idle  (Read 9875 times)

0 Members and 1 Guest are viewing this topic.

Re: Disable button unless Idle
« Reply #10 on: May 08, 2014, 06:20:38 PM »
HIYA guys these are things that should be fixed in the core.

(;-) TP

Come to think of it, I'll agree with that.
Makes sense that some thing should never be allowed to happen under any circumstance.

Steve did say that G28 isn't implemented yet, so it'll probably be taken care of when it is.

Russ
Re: Disable button unless Idle
« Reply #11 on: May 08, 2014, 08:51:10 PM »
I'll clarify...
 (mc.mcCntlIsInCycle(inst) == 1)   a file is running, ==0 would be not running   right ?

if so, what is the call for the following ?
 (mc.mc__________(inst) == 1)   control is enabled, ==0 control is disabled
or is there one?
Russ

(mc.mcCntlIsInCycle(inst) == 1)   a file is running, ==0 would be not running   right ?      -- Correct


Try this;
To use a button to toggle Enable and Disable

--put this in the Screen Load Script
a = 0 -- set a variable

--Place under a button
local inst = mc.mcGetInstance();
if (a == 0) then   --look for the value of a
    a = 1;             --set the value of a
    mc.mcCntlEnable(inst, 1);  -- Enable
elseif (a == 1) then
    a = 0;
    mc.mcCntlEnable(inst, 0);  --Disable
end

Nothings really broke, just needs to be understood, and new code written to do what you want.
Don't expect this to be something your going to learn overnight, Long learning curve
I think I saw the light bulb from here when you seen how to use the Enable property.
I struggle everyday with one thing or another. But I Ain't dead yet.
don't give up

Learn to use the History / Error display to view code when your debugging an issue
This is over kill but it gives you an idea of how to look before and after something you expect to happen or do
the history button shows you the output and you can see what works and whats not. Clear, Close and try it again

local inst = mc.mcGetInstance();
    mc.mcCntlSetLastError(inst, 'mc.mcCntlEnable 1? = ' .. tostring(mc.mcCntlEnable));
    mc.mcCntlSetLastError(inst, 'a1? = ' .. tostring(a));
if (mc.mcCntlEnable ~= 0 and a == 0) then
    mc.mcCntlSetLastError(inst, 'mc.mcCntlEnable 2? = ' .. tostring(mc.mcCntlEnable));
    mc.mcCntlSetLastError(inst, 'a2? = ' .. tostring(a));
     a=1;
    mc.mcCntlEnable(inst, 0);
    mc.mcCntlSetLastError(inst, 'mc.mcCntlEnable 3? = ' .. tostring(mc.mcCntlEnable));
    mc.mcCntlSetLastError(inst, 'a3? = ' .. tostring(a));
elseif (mc.mcCntlEnable ~= 0 and a == 1) then
    mc.mcCntlSetLastError(inst, 'mc.mcCntlEnable 4? = ' .. tostring(mc.mcCntlEnable));
    mc.mcCntlSetLastError(inst, 'a4? = ' .. tostring(a));
     a=0;
    mc.mcCntlEnable(inst, 1);
    mc.mcCntlSetLastError(inst, 'mc.mcCntlEnable 5? = ' .. tostring(mc.mcCntlEnable));
    mc.mcCntlSetLastError(inst, 'a5? = ' .. tostring(a));
end
Re: Disable button unless Idle
« Reply #12 on: May 08, 2014, 10:46:08 PM »
All good info, thanks again for another fine tutorial.
Saved to my study book. ;)
Learning curve ? ? ? ? Andromeda is the radius point of mine !  ::)

I understand the toggle example, excellent explanation.
The History / Error display will take some practice and memorizing, I'll plan to use it.
I can't seem to debug in the editor, f5, then f11 to step through, then crashes every time. Mentioned it to Steve but he never got back. Afraid to use it now. ::)

Thanks Craig,
Russ
 :)

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Disable button unless Idle
« Reply #13 on: May 08, 2014, 10:59:20 PM »
HIYA Ross same problem here with Lua editor . Today has been nothing but a crash fest can't get anything done for it.

OH well there is always tomorrow, (;-) TP

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Disable button unless Idle
« Reply #14 on: May 08, 2014, 11:43:28 PM »
Guys...  don't waste too much time on this button enabling and disabling.  I have just added a new property to all of the GUI objects.  "Enabled State"  You can choose which states the button (or other control) is enabled in with a click of a few check boxes!!!  It will be in the next update.

The Lua editor has a problem with Windows XP.  I have yet to fix that.  But it is on my list.  It is just that XP is not what I develop with so it doesn't get as much love.  XP's GUI event timings are different that the newer OSes.  It has been a real pain.  It would be much simpler for me if all of you guys running XP would just upgrade.  So how about it guys?  How about upgrading for a poor beat up programmer?  :)

Steve
Re: Disable button unless Idle
« Reply #15 on: May 09, 2014, 12:04:53 AM »
Cool, I'll just consider it an exercise in basic scripting, valuable none the less.
More check boxes ... I like check boxes.

I can dump XP shortly, its the least I could do being I'm probably one of the few stuck with my very first computer.
 Is 7-32 compatible ? Or is 64 bit req./preferred ?

Thanks,
Russ


Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Disable button unless Idle
« Reply #16 on: May 09, 2014, 12:20:17 AM »
HIYA guys these are things that should be fixed in the core.

(;-) TP

Just to clarify, the GUI has nothing to do with the core.  It is not like Mach 3.  There is a GUI (could be anything AND written with just about anything), the core, and plugins.  All three are separate.  In fact, we have two GUIs that can be used, Mach4GUI and wxMach.  And I have actually written C# and VB GUIs (for grins) that run the core.  The core is the interpreters, trajectory planners, and signals manager.

Steve

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Disable button unless Idle
« Reply #17 on: May 09, 2014, 12:34:53 AM »
Is 7-32 compatible ? Or is 64 bit req./preferred ?

Thanks,
Russ

Both work well.  I use Win7-32 on my Matsuura.  Works fine.  If you want to EVER run the parallel port, you have to choose Win7-32.  Otherwise, I would go Win7-64.  It seems to be bit more stable.  Win7-32 isn't bad, just that Win7-64 NEVER seems to have an issue.  That's just my experience.

The upgrade thing was just a joke.  While I would really just love to be done with XP and never have to see it again, I do understand that people want to get the most out of their investment.  We are trying REALLY hard to support XP.  It was a good OS.  It is just that it is getting a bit long in the tooth as far as programming for it goes. 

But don't go upgrading if your compy only has 2 Gig of mem or less.  Win7 does require more system resources (memory for sure!).  If you put it on a 2 Gig system, you will end up buying memory sticks too.  The price of the memory plus the price of the Win7 OS may get very close to a new system's price!!  Do your homework.

Steve
Re: Disable button unless Idle
« Reply #18 on: May 24, 2014, 07:47:10 AM »
Hi All
Okay you can change proberty of a button like this: :D

scr.SetProperty('btnGotoZero', 'Enabled', '0');

But I can not understand why you can not change color.?  ???
Is there anyone who can help then it will just be super.

I've tried several combinations also this:

scr.SetProperty('button109', 'Bg Color', '(254,180,175)');

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Disable button unless Idle
« Reply #19 on: May 24, 2014, 08:15:10 AM »
Looks like colors need to be in hex, not rgb.

scr.SetProperty('btnEnable', 'Bg Color', '#00FF00')
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html