Hello Guest it is April 19, 2024, 12:13:30 PM

Author Topic: simple numeric keyboard for input in DRO  (Read 4531 times)

0 Members and 1 Guest are viewing this topic.

Offline TPS

*
  •  2,505 2,505
    • View Profile
simple numeric keyboard for input in DRO
« on: December 22, 2017, 01:25:36 PM »
Hello,

here a simple solution with "on board" possibilities (VB script) to do Inputs to DRO (touch Screen).

put the following code into a macro in your macrofolder:

Code: [Select]

Global value As String

'TPS 01.12.2017
'numerische Eingabe
Function NumericKeyboard(ByVal DRONum as Integer) As Double
Dim title as String
value = GetOemDRO(DRONum)
title = Header


Begin Dialog UserDialog1 60,60, 105, 180, "Eingabe:"  , .Enable

PushButton 10, 10, 25, 25, "7", .but7
PushButton 40, 10, 25, 25, "8", .but8
PushButton 70, 10, 25, 25, "9", .but9

PushButton 10, 40, 25, 25, "4", .but4
PushButton 40, 40, 25, 25, "5", .but5
PushButton 70, 40, 25, 25, "6", .but6

PushButton 10, 70, 25, 25, "1", .but1
PushButton 40, 70, 25, 25, "2", .but2
PushButton 70, 70, 25, 25, "3", .but3

PushButton 10, 100, 25, 25, ".", .butD
PushButton 40, 100, 25, 25, "0", .but0
PushButton 70, 100, 25, 25, "<-", .butB

TextBox 10, 130, 85, 18, .FText
PushButton 10, 155, 40, 21,"OK", .OK
CancelButton 55, 155, 40, 21
End Dialog


Dim Dlg1 As UserDialog1

Dlg1.FText = CStr(value)
x = Dialog( Dlg1 )

NumericKeyboard = CDbl(Dlg1.FText)
SetOEMDro(DRONum,CDbl(Dlg1.FText))
End Function

Function Enable( ControlID$, Action%, SuppValue%)

Select Case Action%
Case 1

Case 2 'Button wurde gerückt
If ControlID$ = "but0" Then
value = CStr(value) + "0"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but1" Then
value = CStr(value) + "1"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but2" Then
value = CStr(value) + "2"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but3" Then
value = CStr(value) + "3"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but4" Then
value = CStr(value) + "4"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but5" Then
value = CStr(value) + "5"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but6" Then
value = CStr(value) + "6"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but7" Then
value = CStr(value) + "7"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but8" Then
value = CStr(value) + "8"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but9" Then
value = CStr(value) + "9"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butD" Then
   If InStr(1,value,".") = 0 Then
value = CStr(value) + "."
DlgText "FText", CStr(value)
Enable =1
   End If
End If
If ControlID$ = "butB" Then
value = Left(value,Len(value)-1)
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "OK" Then
Enable = -1
End If
Case 3 'Text verändert
'MsgBox Dlg1.FText
Case Else
End Select

'Wert zurückgeben
If Enable = -1 Then
Enable = value
End If

End Function   



ok lets say you put into C:\mach3\macros\yourprofile\numerickeyboard.m1s

if you put following code into a transparent button over the a-axis dro
the code do edit x-axis would be:

Code: [Select]
Sub Main
call NumericKeyboard(800)

End Sub


#Expand <\..\..\macros\yourprofile\numerickeyboard>


call NumericKeyboard(800)

the number is the OEMDro you want to edit.

Regards Thomas
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: simple numeric keyboard for input in DRO
« Reply #1 on: February 02, 2018, 11:30:50 AM »
Well isn't that nifty !
I'll save this in the event I ever get a touch screen set-up on one of my machines.
Very cool !
Thanks for the contribution Thomas.

Much appreciated,
Russ
Re: simple numeric keyboard for input in DRO
« Reply #2 on: May 18, 2023, 03:39:38 PM »
Good evening
i installed above the dro ,transparent button,
"simple numeric keyboard" and everything works perfectly
I would like to place it above "MDI" and add the following keys
" X,Y,Z,A,F,SPACE " , I don't know if it's feasible, since it's not
Is there anyone in my capacity who can help me?
as long as it's possible, thanks to anyone who can help me.
Greetings

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: simple numeric keyboard for input in DRO
« Reply #3 on: May 20, 2023, 10:14:11 AM »
not tested

Code: [Select]

Global value As String

'TPS 01.12.2017
'numerische Eingabe
Function NumericKeyboard(ByVal DRONum As Integer) As Double
Dim title As String
'value = GetOemDRO(DRONum)
title = Header


Begin Dialog UserDialog1 60,60, 195, 180, "Input:"  , .Enable

PushButton 10, 10, 25, 25, "7", .but7
PushButton 40, 10, 25, 25, "8", .but8
PushButton 70, 10, 25, 25, "9", .but9

PushButton 10, 40, 25, 25, "4", .but4
PushButton 40, 40, 25, 25, "5", .but5
PushButton 70, 40, 25, 25, "6", .but6

PushButton 10, 70, 25, 25, "1", .but1
PushButton 40, 70, 25, 25, "2", .but2
PushButton 70, 70, 25, 25, "3", .but3

PushButton 10, 100, 25, 25, ".", .butD
PushButton 40, 100, 25, 25, "0", .but0
PushButton 70, 100, 25, 25, "<-", .butB

PushButton 100, 10, 25, 25, "X", .butX
PushButton 100, 40, 25, 25, "Y", .butY
PushButton 100, 70, 25, 25, "Z", .butZ
PushButton 100, 100, 25, 25, "A", .butA

PushButton 130, 10, 25, 25, "F", .butF
PushButton 130, 40, 25, 25, "S", .butS
PushButton 130, 70, 25, 25, "M", .butM
PushButton 130, 100, 25, 25, "Sp", .butSp

PushButton 160, 10, 25, 25, "G", .butG

TextBox 10, 130, 175, 18, .FText
PushButton 10, 155, 40, 21,"OK", .OK
CancelButton 55, 155, 40, 21
End Dialog


Dim Dlg1 As UserDialog1

'Dlg1.FText = CStr(value)
Dlg1.FText = ""
x = Dialog( Dlg1 )

'NumericKeyboard = CDbl(Dlg1.FText)
If x <> 0 Then
'SetOEMDro(DRONum,CDbl(Dlg1.FText))
Code Dlg1.FText
End If
End Function

Function Enable( ControlID$, Action%, SuppValue%)

Select Case Action%
Case 1

Case 2 'Button wurde gerückt
If ControlID$ = "but0" Then
value = CStr(value) + "0"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but1" Then
value = CStr(value) + "1"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but2" Then
value = CStr(value) + "2"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but3" Then
value = CStr(value) + "3"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but4" Then
value = CStr(value) + "4"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but5" Then
value = CStr(value) + "5"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but6" Then
value = CStr(value) + "6"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but7" Then
value = CStr(value) + "7"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but8" Then
value = CStr(value) + "8"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but9" Then
value = CStr(value) + "9"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butD" Then
   If InStr(1,value,".") = 0 Then
value = CStr(value) + "."
DlgText "FText", CStr(value)
Enable =1
   End If
End If
If ControlID$ = "butB" Then
value = Left(value,Len(value)-1)
DlgText "FText", CStr(value)
Enable =1
End If

If ControlID$ = "butX" Then
value = CStr(value) + "X"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butY" Then
value = CStr(value) + "Y"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butZ" Then
value = CStr(value) + "Z"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butA" Then
value = CStr(value) + "A"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butF" Then
value = CStr(value) + "F"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butS" Then
value = CStr(value) + "S"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butM" Then
value = CStr(value) + "M"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butSp" Then
value = CStr(value) + " "
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butG" Then
value = CStr(value) + "G"
DlgText "FText", CStr(value)
Enable =1
End If


If ControlID$ = "OK" Then
Enable = -1
End If
Case 3 'Text verändert
'MsgBox Dlg1.FText
Case Else
End Select

'Wert zurückgeben
If Enable = -1 Then
Enable = value
End If

End Function   





anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: simple numeric keyboard for input in DRO
« Reply #4 on: May 20, 2023, 12:01:14 PM »
Good evening
TPS I tested the code works perfectly,
thank you once again for the help :) :) :) :) :) :) :)
Re: simple numeric keyboard for input in DRO
« Reply #5 on: February 11, 2024, 09:14:11 PM »
Hello,
The Keyboard / MDI screen is exactly what I need. Could someone give clearer instruction right from the start  for a novice?
Thanks in advance

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: simple numeric keyboard for input in DRO
« Reply #6 on: February 12, 2024, 02:31:48 AM »
ok like written earlier in this post, put this code:

Code: [Select]

Global value As String

'TPS 01.12.2017
'numerische Eingabe
Function NumericKeyboard(ByVal DRONum As Integer) As Double
Dim title As String
'value = GetOemDRO(DRONum)
title = Header


Begin Dialog UserDialog1 60,60, 195, 180, "Input:"  , .Enable

PushButton 10, 10, 25, 25, "7", .but7
PushButton 40, 10, 25, 25, "8", .but8
PushButton 70, 10, 25, 25, "9", .but9

PushButton 10, 40, 25, 25, "4", .but4
PushButton 40, 40, 25, 25, "5", .but5
PushButton 70, 40, 25, 25, "6", .but6

PushButton 10, 70, 25, 25, "1", .but1
PushButton 40, 70, 25, 25, "2", .but2
PushButton 70, 70, 25, 25, "3", .but3

PushButton 10, 100, 25, 25, ".", .butD
PushButton 40, 100, 25, 25, "0", .but0
PushButton 70, 100, 25, 25, "<-", .butB

PushButton 100, 10, 25, 25, "X", .butX
PushButton 100, 40, 25, 25, "Y", .butY
PushButton 100, 70, 25, 25, "Z", .butZ
PushButton 100, 100, 25, 25, "A", .butA

PushButton 130, 10, 25, 25, "F", .butF
PushButton 130, 40, 25, 25, "S", .butS
PushButton 130, 70, 25, 25, "M", .butM
PushButton 130, 100, 25, 25, "Sp", .butSp

PushButton 160, 10, 25, 25, "G", .butG

TextBox 10, 130, 175, 18, .FText
PushButton 10, 155, 40, 21,"OK", .OK
CancelButton 55, 155, 40, 21
End Dialog


Dim Dlg1 As UserDialog1

'Dlg1.FText = CStr(value)
Dlg1.FText = ""
x = Dialog( Dlg1 )

'NumericKeyboard = CDbl(Dlg1.FText)
If x <> 0 Then
'SetOEMDro(DRONum,CDbl(Dlg1.FText))
Code Dlg1.FText
End If
End Function

Function Enable( ControlID$, Action%, SuppValue%)

Select Case Action%
Case 1

Case 2 'Button wurde gerückt
If ControlID$ = "but0" Then
value = CStr(value) + "0"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but1" Then
value = CStr(value) + "1"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but2" Then
value = CStr(value) + "2"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but3" Then
value = CStr(value) + "3"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but4" Then
value = CStr(value) + "4"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but5" Then
value = CStr(value) + "5"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but6" Then
value = CStr(value) + "6"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but7" Then
value = CStr(value) + "7"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but8" Then
value = CStr(value) + "8"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "but9" Then
value = CStr(value) + "9"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butD" Then
   If InStr(1,value,".") = 0 Then
value = CStr(value) + "."
DlgText "FText", CStr(value)
Enable =1
   End If
End If
If ControlID$ = "butB" Then
value = Left(value,Len(value)-1)
DlgText "FText", CStr(value)
Enable =1
End If

If ControlID$ = "butX" Then
value = CStr(value) + "X"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butY" Then
value = CStr(value) + "Y"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butZ" Then
value = CStr(value) + "Z"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butA" Then
value = CStr(value) + "A"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butF" Then
value = CStr(value) + "F"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butS" Then
value = CStr(value) + "S"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butM" Then
value = CStr(value) + "M"
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butSp" Then
value = CStr(value) + " "
DlgText "FText", CStr(value)
Enable =1
End If
If ControlID$ = "butG" Then
value = CStr(value) + "G"
DlgText "FText", CStr(value)
Enable =1
End If


If ControlID$ = "OK" Then
Enable = -1
End If
Case 3 'Text verändert
'MsgBox Dlg1.FText
Case Else
End Select

'Wert zurückgeben
If Enable = -1 Then
Enable = value
End If

End Function   


in a macro in your macrofolder like: C:\mach3\macros\your profile name\numerickeyboard.m1s

if you put following code into a transparent button over the X-axis dro
the code do edit x-axis would be:

Code: [Select]
Sub Main
call NumericKeyboard(800)

End Sub


#Expand <\..\..\macros\yourprofile\numerickeyboard.m1s>



call NumericKeyboard(800)

the red number is the OEMDro you want to edit.



« Last Edit: February 12, 2024, 02:33:37 AM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: simple numeric keyboard for input in DRO
« Reply #7 on: February 13, 2024, 12:35:16 PM »
Thank you for the quick reply !