Post by klewlis on Feb 14, 2022 19:01:54 GMT -5
In the help file, under groupbox I find the following.
but disabling a groupbox does not seem to work as shown in the following code. This code is not complete and utilizing any controls may break it.
Is this a bug, or am I doing something wrong?
GROUPBOX #handle.ext, "label", x, y, wide, high...
...
print #handle.ext, "!disable"
This causes the control to be inactive and grayed-out.
but disabling a groupbox does not seem to work as shown in the following code. This code is not complete and utilizing any controls may break it.
'----- Pre-window set up
nomainwin
WindowWidth = 1400
WindowHeight = 722
UpperLeftX = int((DisplayWidth-WindowWidth)/2)
UpperLeftY = int((DisplayHeight-WindowHeight)/2)
MWW = 1400
MWH = 722
BackgroundColor$ = "lightgray"
ForegroundColor$ = "black"
TextboxColor$ = "white"
global BadInfo
global MWW
global MWH
global NumRoof
dim BldgInfo(4, 10)
dim RftrInfo(4, 1000)
dim group(4)
'----- Load array for combobox
for cbcount = 1 to 4
cbitem$(cbcount) = space$(15) + str$(cbcount) + space$(8)
next cbcount
stylebits #main, 0, _WS_MAXIMIZEBOX, 0, 0
statictext #main.NumRoof0, "Number of Roofs", 25, 62, 101, 20
'---------------------------------------------------------------------need sub for combobox (function() for return of numRoof) is that possible? may have to be sub with global
combobox #main.NRInput0, cbitem$(), roofCount, 140, 57, 100, 25
menu #main, Help, about, instruct, measurements, numFormat
for x = 1 to 4
if x > 1 then
for y = 1 to 8
HwndVar$ = "#main." + word$("CToInput CTypInput BWInput BLInput RWInput OhangInput RPitchInput GOhangInput", y) + str$(x)
stylebits #HwndVar$, _ES_CENTER, 0, 0, 0
next y
else
for y = 3 to 8
HwndVar$ = "#main." + word$("CToInput CTypInput BWInput BLInput RWInput OhangInput RPitchInput GOhangInput", y) + str$(x)
stylebits #HwndVar$, _ES_CENTER, 0, 0, 0
next y
end if
next x
'----- Roof 1, (main roof) set up
groupbox #main.RGpbox1, "Roof One, (Main Roof)", 10, 132, 255, 530
statictext #main.BWidth1, "Bldg Width", 25, 172, 85, 20
textbox #main.BWInput1, 140, 167, 100, 25
statictext #main.BLength1, "Bldg Length", 25, 232, 91, 20
textbox #main.BLInput1, 140, 227, 100, 25
statictext #main.RWidth1, "Ridge Width", 25, 292, 102, 20
textbox #main.RWInput1, 140, 287, 100, 25
statictext #main.Ohang1, "Overhang", 25, 352, 59, 20
textbox #main.OhangInput1, 140, 347, 100, 25
statictext #main.RPitch1, "Roof Pitch", 25, 412, 61, 20
textbox #main.RPitchInput1, 140, 407, 100, 25
groupbox #main.RSGpbox1, "Rafter Spacing", 25, 457, 220, 60
radiobutton #main.12Choice1, "1'-0", TwelveSet, TwelveSet, 45, 482, 62, 25
radiobutton #main.16Choice1, "1'-4", SixteenSet, SixteenSet, 112, 482, 62, 25
radiobutton #main.24Choice1, "2'-0", TwoFootSet, TwoFootSet, 180, 482, 62, 25
groupbox #main.CGpbox1, "Roof Style", 25, 537, 220, 60
radiobutton #main.GableChoice1, "Gable", GCSet, GCSet, 65, 562, 62, 25
radiobutton #main.HipChoice1, "Hip", HCSet, HCSet, 160, 562, 62, 25
statictext #main.GOhang1, "Gable Overhang", 25, 622, 100, 20
textbox #main.GOhangInput1, 140, 622, 100, 25
'----- Roof 2 set up
groupbox #main.RGpbox2, "Roof Two", 285, 22, 255, 640
statictext #main.ConnTo2, "Connects To Roof", 300, 62, 115, 20
textbox #main.CToInput2, 415, 57, 100, 25
statictext #main.ConnType2, "Connection Type", 300, 117, 105, 20
textbox #main.CTypInput2, 415, 112, 100, 25
statictext #main.BWidth2, "Bldg Width", 300, 172, 85, 20
textbox #main.BWInput2, 415, 167, 100, 25
statictext #main.BLength2, "Bldg Length", 300, 232, 91, 20
textbox #main.BLInput2, 415, 227, 100, 25
statictext #main.RWidth2, "Ridge Width", 300, 292, 102, 20
textbox #main.RWInput2, 415, 287, 100, 25
statictext #main.Ohang2, "Overhang", 300, 352, 59, 20
textbox #main.OhangInput2, 415, 347, 100, 25
statictext #main.RPitch2, "Roof Pitch", 300, 412, 61, 20
textbox #main.RPitchInput2, 415, 407, 100, 25
groupbox #main.RSGpbox2, "Rafter Spacing", 300, 457, 220, 60
radiobutton #main.12Choice2, "1'-0", TwelveSet, TwelveSet, 320, 482, 62, 25
radiobutton #main.16Choice2, "1'-4", SixteenSet, SixteenSet, 387, 482, 62, 25
radiobutton #main.24Choice2, "2'-0", TwoFootSet, TwoFootSet, 455, 482, 62, 25
groupbox #main.CGpbox2, "Roof Style", 300, 537, 220, 60
radiobutton #main.GableChoice2, "Gable", GCSet, GCSet, 340, 562, 62, 25
radiobutton #main.HipChoice2, "Hip", HCSet, HCSet, 435, 562, 46, 25
statictext #main.GOhang2, "Gable Overhang", 300, 622, 100, 20
textbox #main.GOhangInput2, 415, 622, 100, 25
'----- Roof 3 set up
groupbox #main.RGpbox3, "Roof Three", 560, 22, 255, 640
statictext #main.ConnTo3, "Connects To Roof", 575, 62, 115, 20
textbox #main.CToInput3, 690, 57, 100, 25
statictext #main.ConnType3, "Connection Type", 575, 117, 105, 20
textbox #main.CTypInput3, 690, 112, 100, 25
statictext #main.BWidth3, "Bldg Width", 575, 172, 85, 20
textbox #main.BWInput3, 690, 167, 100, 25
statictext #main.BLength3, "Bldg Length", 575, 232, 91, 20
textbox #main.BLInput3, 690, 227, 100, 25
statictext #main.RWidth3, "Ridge Width", 575, 292, 102, 20
textbox #main.RWInput3, 690, 287, 100, 25
statictext #main.Ohang3, "Overhang", 575, 352, 59, 20
textbox #main.OhangInput3, 690, 347, 100, 25
statictext #main.RPitch3, "Roof Pitch", 575, 412, 61, 20
textbox #main.RPitchInput3, 690, 407, 100, 25
groupbox #main.RSGpbox3, "Rafter Spacing", 575, 457, 220, 60
radiobutton #main.12Choice3, "1'-0", TwelveSet, TwelveSet, 595, 482, 62, 25
radiobutton #main.16Choice3, "1'-4", SixteenSet, SixteenSet, 662, 482, 62, 25
radiobutton #main.24Choice3, "2'-0", TwoFootSet, TwoFootSet, 730, 482, 62, 25
groupbox #main.CGpbox3, "Roof Style", 575, 537, 220, 60
radiobutton #main.GableChoice3, "Gable", GCSet, GCSet, 615, 562, 62, 25
radiobutton #main.HipChoice3, "Hip", HCSet, HCSet, 710, 562, 46, 25
statictext #main.GOhang3, "Gable Overhang", 575, 622, 100, 20
textbox #main.GOhangInput3, 690, 622, 100, 25
'----- Roof 4 set up
groupbox #main.RGpbox4, "Roof Four", 835, 22, 255, 640
statictext #main.ConnTo4, "Connects To Roof", 850, 62, 115, 20
textbox #main.CToInput4, 965, 57, 100, 25
statictext #main.ConnType4, "Connection Type", 850, 117, 105, 20
textbox #main.CTypInput4, 965, 112, 100, 25
statictext #main.BWidth4, "Bldg Width", 850, 172, 85, 20
textbox #main.BWInput4, 965, 167, 100, 25
statictext #main.BLength4, "Bldg Length", 850, 232, 91, 20
textbox #main.BLInput4, 965, 227, 100, 25
statictext #main.RWidth4, "Ridge Width", 850, 292, 102, 20
textbox #main.RWInput4, 965, 287, 100, 25
statictext #main.Ohang4, "Overhang", 850, 352, 59, 20
textbox #main.OhangInput4, 965, 347, 100, 25
statictext #main.RPitch4, "Roof Pitch", 850, 412, 61, 20
textbox #main.RPitchInput4, 965, 407, 100, 25
groupbox #main.RSGpbox4, "Rafter Spacing", 850, 457, 220, 60
radiobutton #main.12Choice4, "1'-0", TwelveSet, TwelveSet, 870, 482, 62, 25
radiobutton #main.16Choice4, "1'-4", SixteenSet, SixteenSet, 937, 482, 62, 25
radiobutton #main.24Choice4, "2'-0", TwoFootSet, TwoFootSet, 1004, 482, 62, 25
groupbox #main.CGpbox4, "Roof Style", 850, 537, 220, 60
radiobutton #main.GableChoice4, "Gable", GCSet, GCSet, 890, 562, 62, 25
radiobutton #main.HipChoice4, "Hip", HCSet, HCSet, 985, 562, 46, 25
statictext #main.GOhang4, "Gable Overhang", 850, 622, 100, 20
textbox #main.GOhangInput4, 965, 622, 100, 25
'----- Calculate button moved here to make it the last control in the tabbing order
button #main.calc0, "Calculate", [GetInfo], UL, 1120, 615, 245, 40
'----- Connections type drawing area
groupbox #main.CTGpbox0, "Roof to Roof Connection Types", 1110, 22, 265, 583
graphicbox #main.Conn1, 1120, 52, 245, 100
graphicbox #main.Conn2, 1120, 162, 245, 100
graphicbox #main.Conn3, 1120, 272, 245, 100
graphicbox #main.Conn4, 1120, 382, 245, 210
'----- Open main window
open "Rafter Master" for window_nf as #main
print #main, "font ms_sans_serif 10"
print #main.calc0, "!font ms_sans_serif 20 bold"
print #main, "trapclose [quit.main]"
print #main.CToInput2, "1"
print #main.NRInput0, "selectindex 1"
'----- Disable unused controls until needed
for x = 1 to 4
HwndVar$ = "#main.GOhang" + str$(x)
print #HwndVar$, "!disable"
HwndVar$ = "#main.GOhangInput" + str$(x)
print #HwndVar$, "!disable"
if x > 1 then
for y = 1 to 22
HwndVar$ = "#main." + word$("RGpbox ConnTo CToInput ConnType CTypInput BWidth BWInput BLength BLInput RWidth RWInput Ohang OhangInput RPitch RPitchInput RSGpbox 12Choice 16Choice 24Choice CGpbox GableChoice HipChoice", y) + str$(x)
if instr(HwndVar$, "Choice") > 0 then
able$ = "disable"
else
able$ = "!disable"
end if
print #HwndVar$, able$
next y
end if
next x
'----- Set focus to number of roofs input
print #main.NRInput0, "setfocus"
'----- Wait for "instant" input or calculate button to be clicked
wait
'----- Gather and check validity of information
[GetInfo]
BadInfo = 0
call calculate NumRoof
wait
'----- End the program
[quit.main]
close #main
end
''''''''''''''subs''''''''''''
'----- Enable / Disable controls per # of roofs selected
sub roofCount handle$
print #main.NRInput0, "selectionindex? NumRoof"
if (NumRoof < 1) or (NumRoof > 4) then
notice "Number of Roofs must be from 1 to 4."
exit sub
end if
end sub
'----- Get and set rafter spacing
sub TwelveSet handle$
a = val(after$(handle$, "Choice"))
BldgInfo(a, 8) = 12
end sub
sub SixteenSet handle$
a = val(after$(handle$, "Choice"))
BldgInfo(a, 8) = 16
end sub
sub TwoFootSet handle$
a = val(after$(handle$, "Choice"))
BldgInfo(a, 8) = 24
end sub
'----- Get and set gable roof style ----- enable gable overhang input
sub GCSet handle$
a = val(after$(handle$, "Choice"))
BldgInfo(a, 9) = 1
HwndVar$ = "#main.GOhang" + str$(a)
print #HwndVar$, "!enable"
HwndVar$ = "#main.GOhangInput" + str$(a)
print #HwndVar$, "!enable"
end sub
'----- Get and set hip roof style ----- disable gable overhang input
sub HCSet handle$
a = val(after$(handle$, "Choice"))
BldgInfo(a, 9) = 2
HwndVar$ = "#main.GOhang" + str$(a)
print #HwndVar$, "!disable"
HwndVar$ = "#main.GOhangInput" + str$(a)
print #HwndVar$, "!disable"
end sub
sub calculate count
end sub
'''''''''''''''functions''''''''''''''
function convert(arch$)
fraction = 0
if arch$ = "" then
convert = 0
exit function
end if
if instr(arch$, "-") < 1 then
convert = 1
exit function
end if
if instr(arch$, chr$(34)) > 0 then
arch$ = upto$(arch$, chr$(34))
end if
if instr(arch$, "'") > 0 then
arch$ = upto$(arch$, "'") + after$(arch$, "'")
end if
if (instr(arch$, " ") < 1) and (instr(arch$, ".") < 1) then
convert = (val(upto$(arch$, "-")) * 12) + (val(after$(arch$, "-")))
end if
if instr(arch$, " ") > 0 then
fraction = eval(after$(arch$, " "))
arch$ = upto$(arch$, " ")
convert = (val(upto$(arch$, "-")) * 12) + (val(after$(arch$, "-"))) + fraction
end if
if instr(arch$, ".") > 0 then
convert = (val(upto$(arch$, "-")) * 12) + (val(after$(arch$, "-")))
end if
end function
function ridge(arch$)
fraction = 0
if arch$ = "" then
ridge = 0
exit function
end if
If (instr(arch$, "'") > 0) or (instr(arch$, "-") > 0) then
ridge = 1
exit function
end if
if instr(arch$, chr$(34)) > 0 then
arch$ = upto$(arch$, chr$(34))
end if
if (instr(arch$, " ") < 1) and (instr(arch$, ".") < 1) then
ridge = val(arch$)
end if
if instr(arch$, " ") > 0 then
fraction = eval(after$(arch$, " "))
arch$ = upto$(arch$, " ")
ridge = val(arch$) + fraction
end if
if instr(arch$, ".") > 0 then
ridge = val(arch$)
end if
end function
Is this a bug, or am I doing something wrong?