Machsupport Forum
Mach Discussion => Mach Screens => Topic started by: leversole 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
-
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
-
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.
-
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
-
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()
-
Thanks! ;D ;D ;D
-
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
-
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
-
I do like that Willie G Skull.
Tweakie.
-
Tweakie if you like I can post/send the VCarve file or the GCode...
-
I would be most grateful if you would zip it and send to my email (address below my avatar).
Tweakie.