Hello Guest it is March 28, 2024, 10:24:10 AM

Author Topic: Key simulators  (Read 6486 times)

0 Members and 1 Guest are viewing this topic.

Key simulators
« on: December 30, 2016, 09:02:58 AM »
I think I like tweaking/enhancing my machine and controls as well as I like making parts! (wood signs mostly)...anyway...I am going back to the drawing board on a new screen set...may buy a touch screen, but that will be the general design...will probably emulate the new Haas stuff.
I do not want a full on keyboard, but on my manual operation page, I would like a few keys (G,T,M, etc) and a number pad...what I am looking for for is guidance on how to press one of the keys and place its value in the MDI. I could brute force it by building a string in a variable and maybe script it to make whatever I am doing happen, but it would be way cooler if I could press my buttons and fill out the MDI, then press enter to execute...as I am typing this I suppose I could fake the MDI and use a user label...hmmmm...if anyone has an elegant solution or point me in the right direction I would love to hear it...

Thanks
Leslie
Re: Key simulators
« Reply #1 on: December 30, 2016, 10:11:20 AM »
Trying to build a string and not working

When I press the first key (clears the msg)

msgtext="" ' clears the variable

msgtext-"G"
SetUserLabel(51, msgtext)

This works, but when I add to the string with the next keypress, it clears the string

Another key...

msgtext=msgtext & "5"  'add the 5 to the string
SetUserLabel(51, msgtext)

In my mind, msgtext should now be "G5", but after pressing both of these keys, I am only getting the 5. is "&" the proper concatenation operator?


Here is my simple keypad






Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Key simulators
« Reply #2 on: January 20, 2017, 02:47:21 PM »
Has each button got its own bit of VB code because the variables are local to that code so you need to save your string to a LABEL/DRO and read it back before you add to it and then re-save it back to the LABEL/DRO.
Without engineers the world stops
Re: Key simulators
« Reply #3 on: January 20, 2017, 02:50:52 PM »
I'll bet that is it..."msgtext" is not a global variable! I assumed it was...so if it was local, it would behave as it is...good suggestion! I will try to write it to a dro. I can make a DRO a string correct?

Thanks
Leslie

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Key simulators
« Reply #4 on: January 20, 2017, 03:00:25 PM »
From the Macro Programmers Reference Manual

GetUserLabel
Function GetUserLabel(LabelNu
m As Integer) As String
This function allows the user to retrieve the
value of an on-screen User label.  “User”
labels are those that are create
d in the screen designer with
the default text containing the
String “UserLabel” followed by one or more digits.
Arguments
:
LabelNum is the numeric portion of the user label default text
.  LabelNum must
be between 0 and 255.
Return Value:
            None           
Example:
‘ Change the text in UserLabel25
SetUserLabel(25, “This is Label 25”)
Page 36
...
‘ Retrieve the text from UserLabel25
LabelText = GetUserLabel(25)
See also: 
            SetUserLabel()           
Without engineers the world stops
Re: Key simulators
« Reply #5 on: January 20, 2017, 03:04:25 PM »
Thanks!  ;D ;D ;D
Re: Key simulators
« Reply #6 on: January 20, 2017, 03:07:58 PM »
If I get this to work, at the end I have to make the MDI equal to the test string...I am at work and not able to look in any of the Mach manuals, but how would I go about actually "executing" this? As I am typing this, maybe it does not have to acutally go to the MDI, I could writer code to simply run the string....hmmmmmmm...so I could use a "fake" mdi (the userlabel that represents the string I built) and have a go button to build the code to run...

will give it a try...

Leslie
Re: Key simulators
« Reply #7 on: January 21, 2017, 05:59:45 PM »
Pretty simple once I got into it...may get clever and put a backspace key in at some point...this is my manual screen and my main screen

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Key simulators
« Reply #8 on: January 22, 2017, 04:23:33 AM »
I do like that Willie G Skull.

Tweakie.
PEACE
Re: Key simulators
« Reply #9 on: January 22, 2017, 11:28:21 AM »
Tweakie if you like I can post/send the VCarve file or the GCode...