the macro "knows" allready witch DRO it has to write too. it knows it form the
function call:
call NumericKeyboard(800)
because 800 (in this example) is the dro number
here:
'numeric Keyboard with MIN/MAX value
Function NumericKeyboard(ByVal DRONum as Integer , ByVal Min as Double , ByVal Max as Double) As Double
Dim title as String
value = GetOemDRO(DRONum)
title = Header
Begin Dialog UserDialog1 60,60, 105, 210, "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
PushButton 10, 130, 25, 25, "+/-", .butN
PushButton 40, 130, 25, 25, "Del", .butDel
TextBox 10, 160, 85, 18, .FText
PushButton 10, 185, 40, 21,"OK", .OK
CancelButton 55, 185, 40, 21
End Dialog
Dim Dlg1 As UserDialog1
Dlg1.FText = CStr(value)
x = Dialog( Dlg1 )
NumericKeyboard = CDbl(Dlg1.FText)
If CDbl(Dlg1.FText) < Min Then NumericKeyboard = Min
If CDbl(Dlg1.FText) > Max Then NumericKeyboard = Max
SetOEMDro(DRONum,NumericKeyboard)
End Function
is the code with MIN/MIX check included
the call would be:
call NumericKeyboard(800,0,400)
with call NumericKeyboard(DRO number,MIN,MAX)
this part of the code:
NumericKeyboard = CDbl(Dlg1.FText)
If CDbl(Dlg1.FText) < Min Then NumericKeyboard = Min
If CDbl(Dlg1.FText) > Max Then NumericKeyboard = Max
SetOEMDro(DRONum,NumericKeyboard)
does the check AND writes the value into the given DRO number