curly
New Member
Posts: 10
|
Post by curly on Dec 30, 2020 11:27:51 GMT
I have a single window, #main, and have 6 static text labels for the plant food I am using, and 6 combo boxes that select dosage from lists, all working fine. I have added another 6 static text labels to the same window, and want to use text boxes to enter info plant height. I cannot get the text boxes to work? Do I need to publish the code or can someone identify my error - I am new to Just Basic
|
|
|
Post by tsh73 on Dec 30, 2020 13:08:16 GMT
What exactly happens\ goes wrong?
and posting code is really more straightforward way.
|
|
|
Post by B+ on Dec 30, 2020 15:59:32 GMT
Tolstoy
The same goes for code, so posting your unhappy code helps pinpoint the problem faster.
Actually you might discover the problem yourself by trying to get a code snippet that shows the problem in fewest possible lines.
Is the problem extracting the contents of the Textbox? That was my first question with Textbox.
JB Help:
an example:
#main.tb1, "!contents? myVariableNumberInAString$"
myNumber = VAL(myVariableNumberInAString$)
PS you don't need the "Print" before the #Handle, you don't need the comma either, your do need " (double quote) to start the command.
|
|
curly
New Member
Posts: 10
|
Post by curly on Dec 31, 2020 11:53:58 GMT
Hi All, and thank you for being so helpful and quick. I have made my code as concise as possible, and have looked at lots of guides on line, but none of them seem to work. The top rows collect data from tables and works fine - I have left my notices in that I use to check the data is being collected correctly. The lower rows are for free data to be typed into the boxes. I used the basic language extensively through 1980s but only recently during Covid lockdown have loked to have another go and discovered how much things have moved on, and discovered Freeform GUI. My early programs were compiled and executed in row order jumping out and back for subroutines, but am now struggling where to put the lines of code that will manipulate the data I collect,and put it on the clipboard for pasting into a Word document. I have put comments of where I think it should go? My attempts at collecting the data from the text boxes have been removed. Thank you all once again.
nomainwin
WindowWidth = 1000 WindowHeight = 800
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
ABC$(1) = "A": ABC$(2) = "B": ABC$(3) = "C"
DEF$(1) = "D": DEF$(2) = "E": DEF$(3) = "F"
GHI$(1)="G": GHI$(2)="H": GHI$(3)="I"
JKL$(1) = "J": JKL$(2) = "K": JKL$(3) = "L"
MNO$(1) = "M": MNO$(2) = "N": MNO$(3) = "O"
statictext #main.statictext1, "ABC", 10, 30, 100, 20 statictext #main.statictext2, "DEF", 110, 40, 60, 40 statictext #main.statictext3, "GHI", 180, 40, 60, 40 statictext #main.statictext4, "JKL", 250, 40, 60, 40 statictext #main.statictext5, "MNO", 320, 40, 60, 40
combobox #main.combobox6, DEF$(), [combobox6DoubleClick], 110, 90, 60, 100 combobox #main.combobox7, GHI$(), [combobox7DoubleClick], 180, 90, 60, 100 combobox #main.combobox8, JKL$(), [combobox8DoubleClick], 250, 90, 60, 100 combobox #main.combobox9, MNO$(), [combobox9DoubleClick], 320, 90, 60, 100
statictext #main.statictext10, "ABC plus", 10, 180, 100, 20 statictext #main.statictext11, "DEF plus", 110, 190, 60, 40 statictext #main.statictext12, "GHI plus", 180, 190, 60, 40 statictext #main.statictext13, "JKL plus", 250, 190, 60, 40 statictext #main.statictext14, "MNO plus", 320, 190, 60, 40
textbox #main.textbox, 110, 240, 60, 25 textbox #main.textbox, 180, 240, 60, 25 textbox #main.textbox, 250, 240, 60, 25 textbox #main.textbox, 320, 240, 60, 25
'START OF PROGRAM
open "MyFirst" for window as #main print #main, "trapclose [quit.main]" print #main, "font ms_sans_serif 8" wait
[quit.main] Close #main END
'END OF PROGRAM
[combobox6DoubleClick] print #main.combobox6,"selection? DEF$" print #main.combobox6,"selectionindex? DEF" notice DEF$ notice DEF wait
[combobox7DoubleClick] print #main.combobox7,"selection? GHI$" print #main.combobox7,"selectionindex? GHI" notice GHI$ notice GHI wait
[combobox8DoubleClick] print #main.combobox8,"selection? JKL$" print #main.combobox8,"selectionindex? JKL" notice JKL$ notice JKL wait
[combobox9DoubleClick] print #main.combobox9,"selection? MNO$" print #main.combobox9,"selectionindex? MNO" notice MNO$ notice MNO wait
|
|
|
Post by tsh73 on Dec 31, 2020 13:31:32 GMT
Hello curly You see that number on the end of control name, like #main.combobox6 ? These needed so your program could tell them apart. Now, you have 4 textboxes called the same... It just can't end good ;) So you just name them differently instead textbox #main.textbox1, 110, 240, 60, 25 textbox #main.textbox2, 180, 240, 60, 25 textbox #main.textbox3, 250, 240, 60, 25 textbox #main.textbox4, 320, 240, 60, 25
after that you use that name to print to textbox #main.textbox1 "1" or read from textbox #main.textbox1 "!contents? var$" notice var$
That's it. EDIT
also, formatting code in a post: there is a button with capital C in a rectangle in inserts CODE tags Between code tags, program should go
|
|
curly
New Member
Posts: 10
|
Post by curly on Dec 31, 2020 17:04:31 GMT
Hi tsh73,
Thank you so much for your really speedy help, it's much appreciated.
I've putmy complete code using the capital C button as requested. After delaring my arrays, there are static text statements, combo boxes, more static text, and then the text boxes that I can't get working. I've entered the text you suggested after the first text box, but it won't run f I remove the apostrophe? I'm clearly doing something quite basic wrong? I will also manipulate the data I collect, and would like to put all the reults on the clipboard to enter in a word document?
nomainwin
WindowWidth = 1000 WindowHeight = 800
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
wir$(1) = "A": wir$(2) = "B": wir$(3) = "C": wir$(4) = "D" wir$(5) = "E": wir$(6) = "F": wir$(7) = "G": wir$(8) = "H"
meth$(1) = "100": meth$(2) = "101": meth$(3) = "102": meth$(4) = "103" meth$(5) = "A": meth$(6) = "B": meth$(7) = "C"
Dim point$(25) point$(1)="1": point$(2)="2": point$(3)="3": point$(4)="4": point$(5)="5" point$(6)="6": point$(7)="7": point$(8)="8": point$(9)="9": point$(10)="10" point$(11)="11": point$(12)="12": point$(13)="13": point$(14)="14": point$(15)="15" point$(16)="16": point$(17)="17": point$(18)="18": point$(19)="19": point$(20)="20" point$(21)="21": point$(22)="22": point$(23)="23": point$(24)="24": point$(25)="25"
Dim cable$(10) cable$(1) = "1": cable$(2) = "1.5": cable$(3) = "2.5": cable$(4) = "4": cable$(5) = "6" cable$(6) = "10": cable$(7) = "16": cable$(8) = "25": cable$(9) = "35": cable$(10) = "50"
Dim mdt$(10) mdt$(1) = "0.20": mdt$(2) = "0.40": mdt$(3) = "5"
Dim mcb$(12) mcb$(1) = "60898": mcb$(2) = "61009": mcb$(3) = "3871": mcb$(4) = "3036" mcb$(11) = "1361": mcb$(12) = "88"
Dim type$(8) type$(1) = "B": type$(2) = "C": type$(3) = "D": type$(4) = "1": type$(5) = "2": type$(6) = "3": type$(7) = "AC": type$(8) = "EV"
DIM rating$(22) rating$(1)="2": rating$(2)="3": rating$(3)="4": rating$(4)="5": rating$(5)="6": rating$(6)="10": rating$(7)="15": rating$(8)="16" rating$(9)="20": rating$(10)="25": rating$(11)="30": rating$(12)="32": rating$(13)="40": rating$(14)="45": rating$(15)="50" rating$(16)="60": rating$(17)="63": rating$(18)="80": rating$(19)="100": rating$(20)="125": rating$(21)="160": rating$(22)="200"
Dim capacity$(6) cap$(1) = "1": cap$(2) = "3": cap$(3) = "5": cap$(4) = "6": cap$(5) = "16": cap$(6) = "33"
Dim rcdrat$(8) rcdrat$(1) = "10": rcdrat$(2) = "30": rcdrat$(3) = "100": rcdrat$(4) = "300" rcdrat$(5) = "500": rcdrat$(6) = "100S": rcdrat$(7) = "300S": rcdrat$(8) = "500S"
Dim maxZs$(2) maxZs$(1) = "1": maxZs$(2) = "2"
Dim InsV$(3) InsV$(1) = "250": InsV$(2) = "500": InsV$(3) = "1000"
Dim yesno$(3) yesno$(1) = "OK": yesno$(2) = "X": yesno$(3) = "N/A"
statictext #main.statictext1, "CIRCUIT DETAILS", 10, 30, 100, 20 statictext #main.statictext2, "Type of wiring", 110, 40, 60, 40 statictext #main.statictext3, "Reference Method", 180, 40, 60, 40 statictext #main.statictext4, "No of points", 250, 40, 60, 40 statictext #main.statictext5, "Live mm2", 320, 40, 60, 40 statictext #main.statictext6, "cpc mm2", 390, 40, 60, 40 statictext #main.statictext7, "Max Dis Time", 450, 40, 60, 40 statictext #main.statictext8, "BS(EN)", 520, 40, 60, 40 statictext #main.statictext9, "Type", 590, 40, 60, 40 statictext #main.statictext10, "Rating (A)", 660, 40, 60, 40 statictext #main.statictext11, "Short circuit capacity (kA)", 730, 40, 60, 40 statictext #main.statictext12, "RCD Ian mA", 810, 40, 60, 40 statictext #main.statictext13, "Maximum permitted Zs", 890, 40, 60, 40
combobox #main.combobox14, wir$(), [combobox14DoubleClick], 110, 90, 60, 100 combobox #main.combobox15, meth$(), [combobox15DoubleClick], 180, 90, 60, 100 combobox #main.combobox16, point$(), [combobox16DoubleClick], 250, 90, 60, 100 combobox #main.combobox17, cable$(), [combobox17DoubleClick], 320, 90, 60, 100 combobox #main.combobox18, cable$(), [combobox18DoubleClick], 390, 90, 60, 100 combobox #main.combobox19, mdt$(), [combobox19DoubleClick], 460, 90, 60, 100 combobox #main.combobox20, mcb$(), [combobox20DoubleClick], 530, 90, 60, 100 combobox #main.combobox21, type$(), [combobox21DoubleClick], 600, 90, 60, 100 combobox #main.combobox22, rating$(), [combobox22DoubleClick], 670, 90, 60, 100 combobox #main.combobox23, cap$(), [combobox23DoubleClick], 740, 90, 60, 100 combobox #main.combobox24, rcdrat$(), [combobox24DoubleClick], 810, 90, 60, 100 combobox #main.combobox25, maxZs$(), [combobox25DoubleClick], 880, 90, 60, 100
statictext #main.statictext26, "TEST RESULTS", 10, 180, 150, 20 statictext #main.statictext27, "Ring circuit r1", 110, 190, 40, 30 statictext #main.statictext28, "Ring circuit rn", 160, 190, 40, 30 statictext #main.statictext29, "Ring circuit r2", 210, 190, 40, 30 statictext #main.statictext30, "R1+R2", 260, 190, 40, 30 statictext #main.statictext31, "R2", 325, 190, 40, 30 statictext #main.statictext32, "Insul Test Volts", 360, 190, 60, 30 statictext #main.statictext33, "L - L", 430, 190, 30, 30 statictext #main.statictext34, "L - N", 480, 190, 30, 30 statictext #main.statictext35, "L - E", 530, 190, 30, 30 statictext #main.statictext36, "N - E", 580, 190, 30, 30 statictext #main.statictext37, "Polarity", 630, 190, 40, 30 statictext #main.statictext38, "Max Zs measured", 685, 190, 50, 30 statictext #main.statictext39, "RCD Dis time (ms)", 745, 190, 50, 30 statictext #main.statictext40, "RCD test button", 805, 190, 60, 30 statictext #main.statictext41, "Manual AFDD test button", 875, 190, 80, 30
textbox #main.textbox42, 110, 225, 40, 23 'print #main.textbox42 "!contents? r1$" 'notice r1$
textbox #main.textbox43, 160, 225, 40, 23 textbox #main.textbox44, 210, 225, 40, 23 textbox #main.textbox45, 260, 225, 40, 23 textbox #main.textbox46, 310, 225, 40, 23 'textbox #main.textbox47, 360, 225, 40, 23 combobox #main.combobox47, InsV$(), [combobox47DoubleClick], 360, 225, 60, 30 textbox #main.textbox48, 420, 225, 40, 23 textbox #main.textbox49, 470, 225, 40, 23 textbox #main.textbox50, 520, 225, 40, 23 textbox #main.textbox51, 570, 225, 40, 23 'textbox #main.textbox52, 620, 225, 40, 23 combobox #main.combobox48, yesno$(), [combobox48DoubleClick], 620, 225, 60, 30 textbox #main.textbox53, 690, 225, 50, 23 textbox #main.textbox54, 750, 225, 50, 23 'textbox #main.textbox55, 810, 225, 50, 23 combobox #main.combobox49, yesno$(), [combobox49DoubleClick], 805, 225, 65, 30 'textbox #main.textbox56, 885, 225, 65, 23 combobox #main.combobox50, yesno$(), [combobox50DoubleClick], 885, 225, 65, 30
'START OF PROGRAM
open "Single Circuit Verification" for window as #main print #main, "trapclose [quit.main]" print #main, "font ms_sans_serif 8" wait
[quit.main] Close #main END
'END OF PROGRAM
[combobox14DoubleClick] print #main.combobox14,"selection? wir$" print #main.combobox14,"selectionindex? wir" 'notice wir$ 'notice wir wait
[combobox15DoubleClick] 'Perform action for the combobox named 'combobox19 print #main.combobox15,"selection? meth$" print #main.combobox15,"selectionindex? meth" 'notice meth$ 'notice meth wait
[combobox16DoubleClick] 'Perform action for the combobox named 'combobox20' print #main.combobox16,"selection? point$" print #main.combobox16,"selectionindex? point" 'notice point$ 'notice point wait
[combobox17DoubleClick] 'Perform action for the combobox named 'combobox21' print #main.combobox17,"selection? cablel$" print #main.combobox17,"selectionindex? cablel" 'notice cablel$ 'notice cablel wait
[combobox18DoubleClick] 'Perform action for the combobox named 'combobox22' print #main.combobox18,"selection? cablec$" print #main.combobox18,"selectionindex? cablec" 'notice cablec$ 'notice cablec wait
[combobox19DoubleClick] 'Perform action for the combobox named 'combobox23' print #main.combobox19,"selection? mdt$" print #main.combobox19,"selectionindex? mdt" 'notice mdt$ 'notice mdt wait
[combobox20DoubleClick] 'Perform action for the combobox named 'combobox24' print #main.combobox20,"selection? mcb$" print #main.combobox20,"selectionindex? mcb" 'notice mcb$ 'notice mcb wait
[combobox21DoubleClick] 'Perform action for the combobox named 'combobox25' print #main.combobox21,"selection? type$" print #main.combobox21,"selectionindex? type" 'notice type$ 'notice type wait
[combobox22DoubleClick] 'Perform action for the combobox named 'combobox26' print #main.combobox22,"selection? rating$" print #main.combobox22,"selectionindex? rating" 'notice rating$ 'notice rating wait
[combobox23DoubleClick] 'Perform action for the combobox named 'combobox27' print #main.combobox23,"selection? cap$" print #main.combobox23,"selectionindex? cap" 'notice cap$ 'notice cap wait
[combobox24DoubleClick] 'Perform action for the combobox named 'combobox28' print #main.combobox24,"selection? rcdrat$" print #main.combobox24,"selectionindex? rcdrat" 'notice rcdrat$ 'notice rcdrat wait
[combobox25DoubleClick] 'Perform action for the combobox named 'combobox28' print #main.combobox25,"selection? maxZs$" print #main.combobox25,"selectionindex? maxZs" 'notice maxZs$ 'notice maxZs wait
[combobox47DoubleClick] print #main.combobox47,"selection? InsV$" notice InsV$ wait
[combobox48DoubleClick] print #main.combobox48,"selection? pol$" notice pol$ wait
[combobox49DoubleClick] print #main.combobox49,"selection? rcdB$" notice rcdB$ wait
[combobox50DoubleClick] print #main.combobox50,"selection? AFDD$" notice AFDD$ wait
|
|
|
Post by B+ on Dec 31, 2020 17:26:19 GMT
Ha! now I have a question:
When storing contents into a variable, does it have to be a string variable or can it be numeric as well ie
#main.textbox1 "!contents? myNumericVariable"
so now I wouldn't have to convert string to number?
Test that:
nomainwin
WindowWidth = 1000 WindowHeight = 600
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
button #main.button, "Get Number", [myNumber], UL, 200, 300, 200, 50 textbox #main.textbox, 100, 200, 200, 50 open "Test a Textbox and a Button" for window as #main #main "font ms_sans_serif 16" #main "trapclose [quit]" #main.textbox "Place number here" wait
[myNumber] #main.textbox "!contents? myNumericVariable" ' get contents as numeric variable notice "Test"+chr$(13)+str$(myNumericVariable) 'chr$(13) to separate title (Test) from body of notice message wait
[quit] close #main end
Answer is Yes!
|
|
|
Post by B+ on Jan 1, 2021 0:29:28 GMT
Hi tsh73, Thank you so much for your really speedy help, it's much appreciated. I've putmy complete code using the capital C button as requested. After delaring my arrays, there are static text statements, combo boxes, more static text, and then the text boxes that I can't get working. I've entered the text you suggested after the first text box, but it won't run f I remove the apostrophe? I'm clearly doing something quite basic wrong? I will also manipulate the data I collect, and would like to put all the reults on the clipboard to enter in a word document? nomainwin
WindowWidth = 1000 WindowHeight = 800
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
wir$(1) = "A": wir$(2) = "B": wir$(3) = "C": wir$(4) = "D" wir$(5) = "E": wir$(6) = "F": wir$(7) = "G": wir$(8) = "H"
meth$(1) = "100": meth$(2) = "101": meth$(3) = "102": meth$(4) = "103" meth$(5) = "A": meth$(6) = "B": meth$(7) = "C"
Dim point$(25) point$(1)="1": point$(2)="2": point$(3)="3": point$(4)="4": point$(5)="5" point$(6)="6": point$(7)="7": point$(8)="8": point$(9)="9": point$(10)="10" point$(11)="11": point$(12)="12": point$(13)="13": point$(14)="14": point$(15)="15" point$(16)="16": point$(17)="17": point$(18)="18": point$(19)="19": point$(20)="20" point$(21)="21": point$(22)="22": point$(23)="23": point$(24)="24": point$(25)="25"
Dim cable$(10) cable$(1) = "1": cable$(2) = "1.5": cable$(3) = "2.5": cable$(4) = "4": cable$(5) = "6" cable$(6) = "10": cable$(7) = "16": cable$(8) = "25": cable$(9) = "35": cable$(10) = "50"
Dim mdt$(10) mdt$(1) = "0.20": mdt$(2) = "0.40": mdt$(3) = "5"
Dim mcb$(12) mcb$(1) = "60898": mcb$(2) = "61009": mcb$(3) = "3871": mcb$(4) = "3036" mcb$(11) = "1361": mcb$(12) = "88"
Dim type$(8) type$(1) = "B": type$(2) = "C": type$(3) = "D": type$(4) = "1": type$(5) = "2": type$(6) = "3": type$(7) = "AC": type$(8) = "EV"
DIM rating$(22) rating$(1)="2": rating$(2)="3": rating$(3)="4": rating$(4)="5": rating$(5)="6": rating$(6)="10": rating$(7)="15": rating$(8)="16" rating$(9)="20": rating$(10)="25": rating$(11)="30": rating$(12)="32": rating$(13)="40": rating$(14)="45": rating$(15)="50" rating$(16)="60": rating$(17)="63": rating$(18)="80": rating$(19)="100": rating$(20)="125": rating$(21)="160": rating$(22)="200"
Dim capacity$(6) cap$(1) = "1": cap$(2) = "3": cap$(3) = "5": cap$(4) = "6": cap$(5) = "16": cap$(6) = "33"
Dim rcdrat$(8) rcdrat$(1) = "10": rcdrat$(2) = "30": rcdrat$(3) = "100": rcdrat$(4) = "300" rcdrat$(5) = "500": rcdrat$(6) = "100S": rcdrat$(7) = "300S": rcdrat$(8) = "500S"
Dim maxZs$(2) maxZs$(1) = "1": maxZs$(2) = "2"
Dim InsV$(3) InsV$(1) = "250": InsV$(2) = "500": InsV$(3) = "1000"
Dim yesno$(3) yesno$(1) = "OK": yesno$(2) = "X": yesno$(3) = "N/A"
statictext #main.statictext1, "CIRCUIT DETAILS", 10, 30, 100, 20 statictext #main.statictext2, "Type of wiring", 110, 40, 60, 40 statictext #main.statictext3, "Reference Method", 180, 40, 60, 40 statictext #main.statictext4, "No of points", 250, 40, 60, 40 statictext #main.statictext5, "Live mm2", 320, 40, 60, 40 statictext #main.statictext6, "cpc mm2", 390, 40, 60, 40 statictext #main.statictext7, "Max Dis Time", 450, 40, 60, 40 statictext #main.statictext8, "BS(EN)", 520, 40, 60, 40 statictext #main.statictext9, "Type", 590, 40, 60, 40 statictext #main.statictext10, "Rating (A)", 660, 40, 60, 40 statictext #main.statictext11, "Short circuit capacity (kA)", 730, 40, 60, 40 statictext #main.statictext12, "RCD Ian mA", 810, 40, 60, 40 statictext #main.statictext13, "Maximum permitted Zs", 890, 40, 60, 40
combobox #main.combobox14, wir$(), [combobox14DoubleClick], 110, 90, 60, 100 combobox #main.combobox15, meth$(), [combobox15DoubleClick], 180, 90, 60, 100 combobox #main.combobox16, point$(), [combobox16DoubleClick], 250, 90, 60, 100 combobox #main.combobox17, cable$(), [combobox17DoubleClick], 320, 90, 60, 100 combobox #main.combobox18, cable$(), [combobox18DoubleClick], 390, 90, 60, 100 combobox #main.combobox19, mdt$(), [combobox19DoubleClick], 460, 90, 60, 100 combobox #main.combobox20, mcb$(), [combobox20DoubleClick], 530, 90, 60, 100 combobox #main.combobox21, type$(), [combobox21DoubleClick], 600, 90, 60, 100 combobox #main.combobox22, rating$(), [combobox22DoubleClick], 670, 90, 60, 100 combobox #main.combobox23, cap$(), [combobox23DoubleClick], 740, 90, 60, 100 combobox #main.combobox24, rcdrat$(), [combobox24DoubleClick], 810, 90, 60, 100 combobox #main.combobox25, maxZs$(), [combobox25DoubleClick], 880, 90, 60, 100
statictext #main.statictext26, "TEST RESULTS", 10, 180, 150, 20 statictext #main.statictext27, "Ring circuit r1", 110, 190, 40, 30 statictext #main.statictext28, "Ring circuit rn", 160, 190, 40, 30 statictext #main.statictext29, "Ring circuit r2", 210, 190, 40, 30 statictext #main.statictext30, "R1+R2", 260, 190, 40, 30 statictext #main.statictext31, "R2", 325, 190, 40, 30 statictext #main.statictext32, "Insul Test Volts", 360, 190, 60, 30 statictext #main.statictext33, "L - L", 430, 190, 30, 30 statictext #main.statictext34, "L - N", 480, 190, 30, 30 statictext #main.statictext35, "L - E", 530, 190, 30, 30 statictext #main.statictext36, "N - E", 580, 190, 30, 30 statictext #main.statictext37, "Polarity", 630, 190, 40, 30 statictext #main.statictext38, "Max Zs measured", 685, 190, 50, 30 statictext #main.statictext39, "RCD Dis time (ms)", 745, 190, 50, 30 statictext #main.statictext40, "RCD test button", 805, 190, 60, 30 statictext #main.statictext41, "Manual AFDD test button", 875, 190, 80, 30
textbox #main.textbox42, 110, 225, 40, 23 'print #main.textbox42 "!contents? r1$" 'notice r1$
textbox #main.textbox43, 160, 225, 40, 23 textbox #main.textbox44, 210, 225, 40, 23 textbox #main.textbox45, 260, 225, 40, 23 textbox #main.textbox46, 310, 225, 40, 23 'textbox #main.textbox47, 360, 225, 40, 23 combobox #main.combobox47, InsV$(), [combobox47DoubleClick], 360, 225, 60, 30 textbox #main.textbox48, 420, 225, 40, 23 textbox #main.textbox49, 470, 225, 40, 23 textbox #main.textbox50, 520, 225, 40, 23 textbox #main.textbox51, 570, 225, 40, 23 'textbox #main.textbox52, 620, 225, 40, 23 combobox #main.combobox48, yesno$(), [combobox48DoubleClick], 620, 225, 60, 30 textbox #main.textbox53, 690, 225, 50, 23 textbox #main.textbox54, 750, 225, 50, 23 'textbox #main.textbox55, 810, 225, 50, 23 combobox #main.combobox49, yesno$(), [combobox49DoubleClick], 805, 225, 65, 30 'textbox #main.textbox56, 885, 225, 65, 23 combobox #main.combobox50, yesno$(), [combobox50DoubleClick], 885, 225, 65, 30
'START OF PROGRAM
open "Single Circuit Verification" for window as #main print #main, "trapclose [quit.main]" print #main, "font ms_sans_serif 8" wait
[quit.main] Close #main END
'END OF PROGRAM
[combobox14DoubleClick] print #main.combobox14,"selection? wir$" print #main.combobox14,"selectionindex? wir" 'notice wir$ 'notice wir wait
[combobox15DoubleClick] 'Perform action for the combobox named 'combobox19 print #main.combobox15,"selection? meth$" print #main.combobox15,"selectionindex? meth" 'notice meth$ 'notice meth wait
[combobox16DoubleClick] 'Perform action for the combobox named 'combobox20' print #main.combobox16,"selection? point$" print #main.combobox16,"selectionindex? point" 'notice point$ 'notice point wait
[combobox17DoubleClick] 'Perform action for the combobox named 'combobox21' print #main.combobox17,"selection? cablel$" print #main.combobox17,"selectionindex? cablel" 'notice cablel$ 'notice cablel wait
[combobox18DoubleClick] 'Perform action for the combobox named 'combobox22' print #main.combobox18,"selection? cablec$" print #main.combobox18,"selectionindex? cablec" 'notice cablec$ 'notice cablec wait
[combobox19DoubleClick] 'Perform action for the combobox named 'combobox23' print #main.combobox19,"selection? mdt$" print #main.combobox19,"selectionindex? mdt" 'notice mdt$ 'notice mdt wait
[combobox20DoubleClick] 'Perform action for the combobox named 'combobox24' print #main.combobox20,"selection? mcb$" print #main.combobox20,"selectionindex? mcb" 'notice mcb$ 'notice mcb wait
[combobox21DoubleClick] 'Perform action for the combobox named 'combobox25' print #main.combobox21,"selection? type$" print #main.combobox21,"selectionindex? type" 'notice type$ 'notice type wait
[combobox22DoubleClick] 'Perform action for the combobox named 'combobox26' print #main.combobox22,"selection? rating$" print #main.combobox22,"selectionindex? rating" 'notice rating$ 'notice rating wait
[combobox23DoubleClick] 'Perform action for the combobox named 'combobox27' print #main.combobox23,"selection? cap$" print #main.combobox23,"selectionindex? cap" 'notice cap$ 'notice cap wait
[combobox24DoubleClick] 'Perform action for the combobox named 'combobox28' print #main.combobox24,"selection? rcdrat$" print #main.combobox24,"selectionindex? rcdrat" 'notice rcdrat$ 'notice rcdrat wait
[combobox25DoubleClick] 'Perform action for the combobox named 'combobox28' print #main.combobox25,"selection? maxZs$" print #main.combobox25,"selectionindex? maxZs" 'notice maxZs$ 'notice maxZs wait
[combobox47DoubleClick] print #main.combobox47,"selection? InsV$" notice InsV$ wait
[combobox48DoubleClick] print #main.combobox48,"selection? pol$" notice pol$ wait
[combobox49DoubleClick] print #main.combobox49,"selection? rcdB$" notice rcdB$ wait
[combobox50DoubleClick] print #main.combobox50,"selection? AFDD$" notice AFDD$ wait
Not seeing what you are trying with the textboxes other than setting up a bunch. You usually need a button (and code for it's click) to tell JB how to process the contents of the textboxes when the user filled them out to his or her satisfaction. That button (and the code for it's click) might create a report of some kind or get going on any sort of thing. See my simple example above.
|
|
|
Post by Rod on Jan 1, 2021 9:29:49 GMT
Curly, the code you entered after the first textbox is the right code but in the wrong place. The way a GUI works is that you present the user with all of the textboxes and comboboxes and let them enter or select what they like. Once they are done you need to give them a way to tell you they are done. So you need another button somewhere like [Enter]
Now when the user clicks that button you are taken to the buttons handler say [enterclicked] This is the code block to read all of the textboxes and comboboxes. So the code tsh73 showed to read a single textbox needs replicated for all the textboxes you want to read.
Then you have all the data in variables ready to compute print or do whatever you like with.
When you get to that stage shout and we can discuss how to get it to the clipboard.
|
|
curly
New Member
Posts: 10
|
Post by curly on Jan 1, 2021 10:33:18 GMT
Thank you, thank you, thank you. I need a bit more help, I now need to manipulate the data I have collected - where do I type the code to do that please?
|
|
|
Post by Rod on Jan 1, 2021 10:54:48 GMT
Just BASIC is an event driven BASIC system. An event fires, a code block is called and the system then WAITs until the next event. So at the end of the code block you have just written to read all the textbox and combobox details you should have a WAIT statement.
Now you need another event, another button, [copy] or better still [print]. When this button is clicked it will go to its handler say [processdata] In that code block you can either print out all your data to a texteditor if you just want to copy and paste it to Word. Better still print it all to a graphicbox and print it directly from Just BASIC.
Look at printform.bas that ships with Just BASIC, its easy to create good looking documents. For copy and paste you can search the forum for "clipboard" several examples exist of how to do that.
This code will copy whatever string variable info you put into mytext$, credits to Cundo But much cleaner to print directly from a graphicbox.
nomainwin
WindowWidth = 384 : WindowHeight = 410 UpperLeftX= int((DisplayWidth-WindowWidth)/2) UpperLeftY= int((DisplayHeight-WindowHeight)/2) texteditor #main.ed, 8, 40, 356, 77 open "Copy" for dialog_nf as #main #main "trapclose [quit]"
mytext$="This is my text to copy" #main.ed "!cls" #main.ed mytext$ #main.ed "!selectall" #main.ed "!copy" notice "Code copied to the clipboard!" 'wait
[quit] close #main end
|
|
curly
New Member
Posts: 10
|
Post by curly on Jan 2, 2021 10:48:01 GMT
Thank you, I am now processing y data - I am currently using the free version of Liberty Just Basic that only allows 2 dimensional arrays - does the purchased version allow larger arrays? This would be really helpful.
|
|
|
Post by tsh73 on Jan 2, 2021 13:07:06 GMT
As far as I know, only 2-dimensional. One could simulate more dimensions by calculating index in single-dimension array. Also, there is a help topic named "Arrays with More than Two Dimensions".
Please tell what for you think you could use more then two dimensions? They say "If all you have is hammer all your problems starting look like a nails", so getting used to JB restrictions I have it hard to imagine uses for higher dimensions.
|
|
|
Post by tenochtitlanuk on Jan 4, 2021 21:38:06 GMT
Among hundreds of LB programs on my website I've only one that refers to 3D or more data, 'tho I have dabbled on occasion. We had some code on the old forum about star coordinates ( 3D) viewed on a 2D screen.... Coding heat spreading out from a reactor core ( which I've done) is easily covered by the Help File method. But displaying in anything like realtime becomes difficult. And lots of storage space is needed for large datasets... 'Algorithms plus data equals programs'. Like Anatoly, I wonder what you are coding that needs multi-dimension arrays? Are other algorithmic approaches possible for your application?
|
|
|
Post by tenochtitlanuk on Jan 4, 2021 23:49:33 GMT
Dug up an old example. Imagine a circular atomic reactor at constant temperature in the middle of a cubic tank of water. Initially the water has a vertical temperature gradient. This animated gif shows the horizontal slices at this initial condition. The code generates this initial situation in a minute or two. Here I saved each layer and assembled them as an animated GIF. Suppose you now allow the temperature to rise in the water near the sphere. If only conduction is allowed this is quite quick to calculate. Don't try to add convection- MUCH longer calculation. This is why weather calculations were sloer than the actual speed the weather developed until VERY recently- and is leading-edge stuff even with supercomputers and thousands of video card processers allocated to each voxel ( the 3D equivalent of a pixel) You might like to tun the code to get an idea of the slowness of calculations on 3D data sets! 'nomainwin now =time$( "seconds")
global N: N =100
dim threeD( N^3)
for x =0 to N -1 for y =0 to N -1 for z =0 to N -1 'call arrayPut x, y, z, int( 256 *rnd( 1)) R =int( ( ( x -40)^2 +( y -40)^2 +( z -27)^2)^0.5) if R >25 then call arrayPut x, y, z, 255 else call arrayPut x, y, z, 0 scan next z next y next x
print time$( "seconds") -now ; " seconds to generate 3D array" now =time$( "seconds")
WindowWidth =440 WindowHeight =480
open "3D arrays" for graphics_nsb as #wg
#wg "trapclose quit" #wg "down ; size 4"
for z =0 to N -1 for y =0 to N -1 for x =0 to N -1 v =arrayGet( x, y, z) #wg "color "; v; " "; int( 256 *z /N); " "; 255 -v #wg "set "; 5 +4 *x; " "; 440 -4 *y scan next x next y #wg "getbmp scr 1 1 440 480" bmpsave "scr", "screens2/layer" +right$( "000" +str$( z), 3) +".bmp" next z
print time$( "seconds") - now ;" seconds to display all layers of 3D array"
wait
sub arrayPut i, j, k, value ' limited to 100 by 100 by 100 terms threeD( i +N *j +N^2 *k) =value end sub
function arrayGet( i, j, k) ' limited to 100 by 100 by 100 terms arrayGet =threeD( i +N *j +N^2 *k) end function
sub quit h$ close #wg end end sub
|
|