TreeView issues...
Posted: Wed Sep 17, 2008 4:07 am
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
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