Parents and children

In this category you can exchange your programming questions and solutions.
Post Reply
albert
Posts: 24
Joined: Wed Jun 24, 2009 12:39 am

Parents and children

Post: # 454Post albert
Tue Jul 07, 2009 3:36 am

Why can`t an array element be a parent??

I keep getting errors that say mypanel(0) is not an object.

fred
Posts: 54
Joined: Thu Apr 23, 2009 10:08 am

Parents and children

Post: # 455Post fred
Tue Jul 07, 2009 8:28 am

I`m not sure what you mean but you can define a array of objects but not an array of properties if i`m right.
You want to use mypane(0).Color (or something like that)?

albert
Posts: 24
Joined: Wed Jun 24, 2009 12:39 am

Parents and children

Post: # 456Post albert
Tue Jul 07, 2009 4:53 pm

dim myform as form

dim tab as tabcontrol
tab.parent=myform
tab.Tabs(0)="01"
tab.Tabs(1)="02"
tab.Tabs(2)="03"
tab.Tabs(3)="04"


dim panels(4) as panel
panels(0).parent=tab
panels(1).parent=tab
panels(2).parent=tab
panels(3).parent=tab


dim edits(4) as edit
edits(0).parent=panels(0)  ```` error says panels(0) not declared !!!
edits(1).parent=panels(1)
edits(2).parent=panels(2)
edits(3).parent=panels(3)



myform.ShowModal

fred
Posts: 54
Joined: Thu Apr 23, 2009 10:08 am

Parents and children

Post: # 457Post fred
Wed Jul 08, 2009 10:57 am

It looks like the compiler does not know the array on the right side.
For this the admin or others will have to answer this one :(

PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

Parents and children

Post: # 458Post PaPi
Tue Jul 14, 2009 8:59 am

Hi guys, here is an example for albert`s problem:
(not with "edit", rather with "richedit")

`tab_example by PaPi
dim myform as form
dim i as integer
dim tab as tabcontrol
tab.parent=myform
tab.Tabs(0)="00"
tab.Tabs(1)="01"
tab.Tabs(2)="02"
tab.Tabs(3)="03"
tab.onchange=TC

dim panels(4) as panel
for i=tab.TabsCount to 0 step -1
     panels(i).parent=tab
     panels(i).left=6
     panels(i).top=26
     panels(i).caption="this is panel "+str$(i)
     panels(i).width=tab.width-12
     panels(i).height=tab.height-32
next i

dim richedits(4) as richedit
for i=tab.TabsCount to 0 step -1
     richedits(i).parent=tab
     richedits(i).left=6
     richedits(i).top=26
     richedits(i).text="this is richedit "+str$(i)
     richedits(i).width=tab.width-12
     richedits(i).height=(tab.height-32)/tab.TabsCount*(i+1)
next i

tab.tabindex=0
TC()

myform.ShowModal  


sub TC()
     dim i as integer
     for i=0 to tab.TabsCount
     if i=tab.tabindex then
           panels(i).visible=true
           richedits(i).visible=true
     else
           panels(i).visible=false
           richedits(i).visible=false
     end if
     next i
end sub

best regards
PaPi

Post Reply