To be honest.....it is trash. [working on the last but funnest parts of FnxDesigner]
WARNING -- this is long with code examples...............
After many funny problems I did remember, from years ago, that Basic is reversed in the array definitions from Delphi, just like Delphi uses BGR and Basic is RGB for color [not discussing who is right or wrong, it is just different], so the array for TreeView is [Level1, Level0] instead of [Level0, Level1] but that does not matter.
Here is the full basic code...............
OBJECT MyForm AS Form
Left=271
Top=106
Caption="New Form"
ClientHeight=393
ClientWidth=384
Color=&HFF00000F
OBJECT TreeView1 AS TreeView
Left=30
Top=50
Width=297
Height=138
TabOrder=0
Caption(0)="0"
Caption(1)="1"
Caption(2)="2"
Caption(3)="3"
Sorted=False
END OBJECT
END OBJECT
This is fine you get 4 objects in the tree
1
2
3
4
Now the fun part [just the Caption part and not the entire code - replace it and see what happens]
Caption(0)="0"
Caption(1,0)="0-1" `[the Microsoft reversed logic instead of (0,1) ]
Caption(1)="1"
Caption(2)="2"
this compiles and runs BUT........you get
0
--1
2
SHOULD BE......
0
--0-1
1
2
SEE....the array level failed
NOW let`s try the reversed array definition [resolve the VB/Delphi confusion]
Caption(0)="0"
Caption(0,1)="0-1" `[this (0,1) makes sense Level0 then Level1]
Caption(1)="1"
Caption(2)="2"
OOPS....COMPILES BUT FAILS TO RUN [need task manager to kill the EXE]
----------------------------------------
Now where are the problems: manual? or compiler?
the manual reads.........
Caption(index[,at index).......yep missing the ]
which means you add ",at index" to achieve the "levels" of the tree and can be even more Level2,Level1,Level0.
but as shown above it does not work....
and finally..........
any array definition beyond 2 levels FAILS TO COMPILE
Caption(0)="0"
Caption(0,0)="0-0"
Caption(1)="1"
Caption(0,1)="1-0"
Caption(0,0,1)="0-0-1" `<<<<< FAILS HERE
Caption(2)="2"
Caption(0,2)="2-0"
Caption(0,0,2)="2-0-0"
Caption(0,0,0,2)="2-0-0-0"
Error From the log file [fnx.log]:
error:45 line:18 is not a valid operator
WTF is the -- has nothing to do with the ASCII code provided in the *.BAS file
If anyone can provide workable code and get yourself past the Hurricane Ike ravaged Houston area down to South Texas then I owe you what the British say is "a pint" [really a quart of *jet fuel*]
--Trey Pattillo
TreeView issues...
TreeView issues...
Hi I think there is nothing wrong wit it but you can use a caption one time otherwise you change the tree.
caption(0) means you add a caption at the root the next caption will be 1.
Asume 1 will be the child of 0 the declaration will be caption(1,0).
lets just add another caption to it as child the number will be 3 at caption 1
caption(3,1)="child". The next number will be 4 to add it at the root caption(4)="root".
Your first code must be
t.caption(0)="0"
t.caption(1,0)="0-1"
t.caption(2)="1"
t.caption(3)="2"
to adress a caption once it has been defined you can use its number
showmessage t.caption(1) results in "0-1"
or change it caption(1)="john"
best regards marco
ps if you skip an index at the declaration there will be an error
caption(0) means you add a caption at the root the next caption will be 1.
Asume 1 will be the child of 0 the declaration will be caption(1,0).
lets just add another caption to it as child the number will be 3 at caption 1
caption(3,1)="child". The next number will be 4 to add it at the root caption(4)="root".
Your first code must be
t.caption(0)="0"
t.caption(1,0)="0-1"
t.caption(2)="1"
t.caption(3)="2"
to adress a caption once it has been defined you can use its number
showmessage t.caption(1) results in "0-1"
or change it caption(1)="john"
best regards marco
ps if you skip an index at the declaration there will be an error
TreeView issues...
thanks, Yabb that explained it enough to figure out
ControlName ( ItemIndex [, Level] )
where ItemIndex it the index number from top to bottom [count] of all items - like a strings that make up a Memo, each line
and Level is the indentation.
Root items DO NOT have a Level , so first indent level is 0 .... ?
The below code works and outputs:
0 [root - no level]
0-0 [level 0]
0-1 [level 1]
0-2 [level 2]
0-3 [level 3]
0-3a [same level 3]
0-1a [level 1]
1 [root -no level]
--------------- BEGIN CODE from FnxDesigner TreeView.BAS --------------
OBJECT NewForm AS Form
Left=271
Top=106
Caption="New Form"
ClientHeight=393
ClientWidth=384
Color=&HFF00000F
OBJECT TreeView1 AS TreeView
Left=10
Top=60
Width=361
Height=151
TabOrder=0
Caption(0)="0"
Caption(1,0)="0-0"
Caption(2,1)="0-1"
Caption(3,2)="0-2"
Caption(4,3)="0-3"
Caption(5,3)="0-3a"
Caption(6,1)="0-1a"
Caption(7)="1"
Sorted=False
OnClick=TreeView1Click
END OBJECT
OBJECT Button1 AS Button
Left=10
Top=230
Width=111
Height=25
Caption="Show Item #4 0-3"
TabOrder=1
OnClick=Button1Click
END OBJECT
OBJECT Panel1 AS Panel
Left=140
Top=230
Width=231
Height=25
Caption="Panel1"
TabOrder=2
END OBJECT
END OBJECT
NewForm.ShowModal
SUB Button1Click()
`your code here
showmessage TreeView1.Caption ( 4 )
END SUB `{Button1Click}
SUB TreeView1Click()
`your code here
Panel1.Caption = TreeView1.Caption ( TreeView1.SelectedIndex )
END SUB `{TreeView1Click}
--------------- END CODE --------------
ControlName ( ItemIndex [, Level] )
where ItemIndex it the index number from top to bottom [count] of all items - like a strings that make up a Memo, each line
and Level is the indentation.
Root items DO NOT have a Level , so first indent level is 0 .... ?
The below code works and outputs:
0 [root - no level]
0-0 [level 0]
0-1 [level 1]
0-2 [level 2]
0-3 [level 3]
0-3a [same level 3]
0-1a [level 1]
1 [root -no level]
--------------- BEGIN CODE from FnxDesigner TreeView.BAS --------------
OBJECT NewForm AS Form
Left=271
Top=106
Caption="New Form"
ClientHeight=393
ClientWidth=384
Color=&HFF00000F
OBJECT TreeView1 AS TreeView
Left=10
Top=60
Width=361
Height=151
TabOrder=0
Caption(0)="0"
Caption(1,0)="0-0"
Caption(2,1)="0-1"
Caption(3,2)="0-2"
Caption(4,3)="0-3"
Caption(5,3)="0-3a"
Caption(6,1)="0-1a"
Caption(7)="1"
Sorted=False
OnClick=TreeView1Click
END OBJECT
OBJECT Button1 AS Button
Left=10
Top=230
Width=111
Height=25
Caption="Show Item #4 0-3"
TabOrder=1
OnClick=Button1Click
END OBJECT
OBJECT Panel1 AS Panel
Left=140
Top=230
Width=231
Height=25
Caption="Panel1"
TabOrder=2
END OBJECT
END OBJECT
NewForm.ShowModal
SUB Button1Click()
`your code here
showmessage TreeView1.Caption ( 4 )
END SUB `{Button1Click}
SUB TreeView1Click()
`your code here
Panel1.Caption = TreeView1.Caption ( TreeView1.SelectedIndex )
END SUB `{TreeView1Click}
--------------- END CODE --------------