Post by curly on Jul 23, 2021 9:15:41 GMT -5
Hi Rod,
I have aplied your keypad with various tweeks to a single textbox in my main program, and likewise to to the sample I posted last week. It is really frustrating me as the keypad appears in the top left corner of my main window. It will work as it is, but for my own benefit, should I be able to force the keypad to appear near where the button is clicked? I have read and read about graphic boxes and windows, and tried everything I can think of, but if I change anything it doesn't work.
Kind regards, David
I have aplied your keypad with various tweeks to a single textbox in my main program, and likewise to to the sample I posted last week. It is really frustrating me as the keypad appears in the top left corner of my main window. It will work as it is, but for my own benefit, should I be able to force the keypad to appear near where the button is clicked? I have read and read about graphic boxes and windows, and tried everything I can think of, but if I change anything it doesn't work.
Kind regards, David
nomainwin
WindowWidth = 1100
WindowHeight = 900
UpperLeftX= int((DisplayWidth-WindowWidth)/2)
UpperLeftY= int((DisplayHeight-WindowHeight)/2)
[StartUp]
DIM row(30) 'this simplifies laying out rows of textboxes
for i = 1 to 29
row(i) = i * 30
next i
Dim system$(200): Dim JOBS$(50): Dim jobs$(15): Dim Jobs$(50,15): Dim ClipBoard$(100): Dim CLIENT$(50): Dim client$(10): Dim Premises$(15)
Dim Encrypt$(260,2): Dim CCU$(500,34): Dim User$(100,15): Dim Client$(50,10): Dim Observation$(99)
Dim ExtentS(10): Dim ExtentShort$(10): Dim AgreedL$(10): Dim AgreedLShort$(10): Dim OperationalL$(10): Dim OperationalLShort$(10)
Dim cap$(20): Dim IntLoc$(10)
user$ = "": ccu = 1: way = 1: way$ = "1": pos = 1: POS = 1: TPN$ = "0": validate$ = "": ZsPC$ = "80%"
system$(41) = TPN$: system$(39) = ZsPC$: Records$ = "NO": cct = 1: cct$ = "1"
'End of startup
[CircuitSchedules] 'Collect system and circuit data
if CSWindow = 1 then 'this checks if the CircuitSchedules window is open but hidden and brings it into view.
' print #home.tb104R, "!hide"
' print #home.tb104O, "!show"
print #DataIn.Textbox1,"!setfocus"
goto [CircuitSchedulesWait]
wait 'just in case
end if
WindowWidth = 1100
WindowHeight = 900
' gosub [DimArraysAndDefineValues]
gosub [DataInGuiObjects]
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
open "Circuits" for window as #DataIn
' gosub [HideYellowSystemBoxes]
' gosub [HideCircuitBoxes]
' gosub [HideYellowCircuitBoxes]
CSWindow = 1
print #DataIn, "trapclose [quit.DataIn]"
' print #DataIn, "font ms_sans_serif 8"
' print #DataIn.Textbox105, "!disable"
' print #DataIn.Textbox105, way$
goto [CircuitSchedulesWait]
[quit.DataIn]
Close #DataIn
End
[CircuitSchedulesWait] 'this decides which buttons should remain active -I decided to hide them
'to avoid people asking why the button didn't work
' print #DataIn.button1, "!hide"
'if POS > pos then
print #DataIn.button1, "!show"
'end if
'print #DataIn.button3, "!hide"
'if pos > 1 then
print #DataIn.button3, "!show"
'end if
' print #DataIn.button4, "!hide"
'if pos > 1 then
' if pos = POS then
print #DataIn.button4, "!show"
' end if
'end if
' print #DataIn.button5, "!hide"
'if CCU$(pos,7) > "" then
print #DataIn.button5, "!show"
'end if
wait
[b120]
tbh$ = "#DataIn.Textbox120"
gosub [touchinput]
wait
[touchinput]
if tbt=0 then
nomainwin
WindowWidth = 162
WindowHeight = 162
graphicbox #1.gb 0,0,162,162
open "Input" for window_popup as #1
#1 "trapclose [close]"
k$=" 7 , 8 , 9 ,N/A, 4 , 5 , 6 ,LIM, 1 , 2 , 3 ,---, 0 , . ,del,OK"
k=1
#1.gb "down ; backcolor darkgray ; color white"
for y= 0 to 120 step 40
for x= 0 to 120 step 40
#1.gb "place ";x;" ";y;" ; boxfilled ";x+40;" ";y+40
#1.gb "place ";x+12;" ";y+25
#1.gb "\";word$(k$,k,",")
k=k+1
next
next
#1.gb "flush seg"
'start event tracking
#1.gb "when leftButtonUp [gettouch]"
tbt=1
end if
#1.gb "setfocus"
goto [CircuitSchedulesWait]
[gettouch]
x=int(MouseX/40)
y=int(MouseY/40)
i$=word$(k$,4*y+x+1,",")
if i$=" OK " then goto [close]
if i$=" < " then c$=left$(c$,len(c$)-1)
if i$="---" then #tbh$, ""
if i$="LIM" then #tbh$, ""
if i$="N/A" then #tbh$, ""
#tbh$ "!contents? c$"
if i$="del" then
c$=left$(c$,len(c$)-1)
#tbh$, c$
else
#tbh$, c$+trim$(i$)
end if
goto [CircuitSchedulesWait]
[close]
tbt=0
close #1
return
[quit]
if tbt then close #1
close #t
end
[DataInGuiObjects] 'this is just one row of textboxes - comboboxes have been left out
statictext #DataIn.statictext120, "Ring circuit r1", 50, row(21), 40, 30
statictext #DataIn.statictext121, "Ring circuit rn", 111, row(21), 40, 30
statictext #DataIn.statictext122, "Ring circuit r2", 172, row(21), 40, 30
statictext #DataIn.statictext123, "R1+R2", 233, row(21), 40, 30
statictext #DataIn.statictext124, "R2", 294, row(21), 40, 30
statictext #DataIn.statictext125, "Insul Test Volts", 355, row(21), 60, 30
statictext #DataIn.statictext126, "L - L", 436, row(21), 30, 30
statictext #DataIn.statictext127, "L - N", 497, row(21), 30, 30
statictext #DataIn.statictext128, "L - E", 558, row(21), 30, 30
statictext #DataIn.statictext129, "N - E", 614, row(21), 30, 30
statictext #DataIn.statictext130, "Polarity", 680, row(21), 40, 30
statictext #DataIn.statictext131, "Max Zs measured", 760, row(21), 50, 30
statictext #DataIn.statictext132, "RCD Dis time (ms)", 830, row(21), 50, 30
statictext #DataIn.statictext133, "RCD test button", 900, row(21), 60, 30
statictext #DataIn.statictext134, "Manual AFDD test button", 985, row(21), 80, 30
button #DataIn.button1, "Next Way", [NextWay], UL, 50, row(24), 100,50
button #DataIn.button2, "Pre-Fill", [PreFill], UL, 200, row(24), 100,50
button #DataIn.button3, "Previous Way", [LastWay], UL, 350, row(24), 100,50
button #DataIn.button4, "New CCU", [NextCCU], UL, 500, row(24), 100,50
button #DataIn.button5, "Save Way", [SaveButton], UL, 650, row(24), 100, 50
button #DataIn.button6, "Pause", [GoHome], UL, 800,row(24),100,50
button #DataIn.button7, "Finished", [ValidateCircuit], UL, 950, row(24), 100,50
Textbox #DataIn.Textbox120, 50, row(22), 40, 23 'r1
button #DataIn.b120, "^", [b120], UL, 55,row(23),30,20
Textbox #DataIn.Textbox121, 111, row(22), 40, 23 'rn
Textbox #DataIn.Textbox122, 172, row(22), 40, 23 'r2
Textbox #DataIn.Textbox123, 233, row(22), 40, 23 'R1R2
Textbox #DataIn.Textbox124, 294, row(22), 40, 23 'R2
Textbox #DataIn.Textbox126, 436, row(22), 40, 23 'L-L
Textbox #DataIn.Textbox127, 497, row(22), 40, 23 'L-N
Textbox #DataIn.Textbox128, 558, row(22), 40, 23 'L-E
Textbox #DataIn.Textbox129, 614, row(22), 40, 23 'N-E
Textbox #DataIn.Textbox131, 760, row(22), 50, 23 'Max measured Zs
Textbox #DataIn.Textbox132, 830, row(22), 50, 23 'RCD disconnection time ms
return
[NextWay] 'if the next way in the fuseboard exists, this restores it to the screen
goto [CircuitSchedulesWait]
[PreFill] ' this allows regular circuits to be selected and prefilled
goto [CircuitSchedulesWait]
[LastWay] 'this allows the last circuit created or viewed to be restored and edited if necessary
goto [CircuitSchedulesWait]
[NextCCU] 'this creates another fuseboard
goto [CircuitSchedulesWait]
[SaveButton] 'this checks the data that has been entered and saves all data for the job
goto [CircuitSchedulesWait]
[GoHome] 'this switches focus to the home window
goto [CircuitSchedulesWait]
[ValidateCircuit] 'this will validate the whole system when completed before saving
goto [CircuitSchedulesWait]