Hello Guest it is March 28, 2024, 04:35:33 AM

Author Topic: Image Buttons and images on screen  (Read 7872 times)

0 Members and 1 Guest are viewing this topic.

Offline RICH

*
  • *
  •  7,427 7,427
    • View Profile
Re: Image Buttons and images on screen
« Reply #10 on: May 09, 2014, 08:13:33 AM »
May want to consider adding a Tab like this and populate whatever you want for help.
It can be images or whatever. You'll need to play with the images some....been a while since I played with the screen editor.

RICH

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Image Buttons and images on screen
« Reply #11 on: May 09, 2014, 03:38:23 PM »
OK I have a screen button with custom code and it DOES exactly what I want it to do . HOW do I assign a hotkey to THAT button so that when I press {F11} it does the Function.

I only need one complete example of how it works, );-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Image Buttons and images on screen
« Reply #12 on: May 09, 2014, 03:53:41 PM »
HIYA RICH THat is what I do to create things I create a seperate TAB(page) then use that page to base everything on. It was to keep me from messing OTHER pages UP until I found the the screen editor can do that FOR me (mess up other screens) automaticaly (;-)

(;-) TP

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Image Buttons and images on screen
« Reply #13 on: May 09, 2014, 04:01:05 PM »
In Mach 4, it is better not to think of buttons that do things.  To implement something that a button AND a key press does, it is better to define the action in the screen script and have both the button and key press call that script function.  That way, you are not duplicating code and when you make changes, you make them in one place.

So in the PLC script:

function mySuperFunc
   -- A script function that does what I want.
   ...
end

Then, in the button Left Up scritp:

mySuperFunc();

Then, using the keyboard plugin, you map a key to an named input.  At this point, you have two options:

1.  Look at that input in the PLC script directly using mcIoGetHandle() and mcIoGetState() directly.  However, it is hard to catch a momentary push this way.

or
2.  Map the I/O to and input signal and catch the state change in the screen signals script.


I prefer method 2.

So map the keypord input to say Mach Input signal Input#1.  Then in the screen signal script do:

local inst = mc.mcGetInstance();

if (sig == mc.ISIG_INPUT1) then
    if (state == 1) then
        mySuperFunc();
    end
end


Steve

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Image Buttons and images on screen
« Reply #14 on: May 09, 2014, 04:08:24 PM »
(;-) so I can't check a box and push a hotkey ?? HUM ??? I think the average JOE chip slinger is in trouble, Houston we have a problem.(;-)

I have NO idea what and where those things are BUT I will work on it for a while and see what becomes of it. WHAT is a PLC script in mach4? where is it located?

Thanks Steve(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Image Buttons and images on screen
« Reply #15 on: May 09, 2014, 05:18:26 PM »
OK I have looked at this.

I only find 1 file that mentioned PLC it is MACHPLC it is in the profile dir. It only has 1 line in it. IS THIS IT???

To keep it simple I want to "Load A gcode file"   so I add

function mysuperscript
???? to do load gcode. I have no clue here what to add.
end

Screen signal Script ?? I have no idea what or where this is. I see mention of it in the LUA script window IS this where it is and where is it located so that I can edit it.


Config the KEYBOARD function THAT I can do.


(;-) TP
Re: Image Buttons and images on screen
« Reply #16 on: May 09, 2014, 05:24:23 PM »
Under screen edits

That's a great Idea Rich
« Last Edit: May 09, 2014, 05:31:01 PM by Ya-Nvr-No »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Image Buttons and images on screen
« Reply #17 on: May 10, 2014, 10:37:54 AM »
OK THIS aint happening (;-) The best I can do it end up with a hand full of error messages AND lock up mach4.

QUESTION in the keyboard config it asks all the important question to set up a hotkey(very Simple) To the far right side there is a FUNCTION box BUT it only has jog functions. Could not the REST of mach4 function be added to the list. Things like cycle start,load Gcode,edit gcode,etc.

AND add a CustomFunction selection where you just drop your SuperFunction() code into the window and be done with it.

Easy Peasy, Yous guys are programmers right ? PLEASE throw some magic monkey dust at it and make it happen.  Something as important as Hotkeys for NON MOUSE control panels should be an automatic and easy thing to assign for a CNC controller (;-).

Just a thought, (;-) TP