KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Dynamically adding tab pages

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Mon Jun 29, 2009 3:31 pm    Post subject: Dynamically adding tab pages Reply with quote

Hi All,

I'm building an application that adds tab pages according to the size of an array. For testing I hardcoded the number of tab pages to 6.

Running the code shows 1 to 6 on the screen and a 0 indicating that the tab page is created successfully but I get no tab pages.

Any bright ideas?

Code:

$TabControl1 = $System.TabControl()
$TabControl1.Height = 590
$TabControl1.Left = 10
$TabControl1.Top = 10
$TabControl1.Width = 730
$nul = $Form1.Controls.Add($TabControl1)

For $i = 1 to 6
   ?$i
   $TabPage + $i = $System.TabPage()
   $TabPage + $i.BackColor = $System.Color.FromName("Transparent")
   $TabPage + $i.Text = $i
   $nul = $TabControl1.Controls.Add($TabPage + $i)
Next

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
eriqjaffe
KiXforms Follower
KiXforms Follower


Joined: 16 Aug 2004
Posts: 19
Location: Arlington Heights, IL, USA

PostPosted: Mon Jun 29, 2009 4:13 pm    Post subject: Reply with quote

I tried your code and got the same behavior. But this method worked:

Code:
dim $array[5] ; you say you're basing it on the size of an array, so here's an array!

For $i = 0 to ubound($array)
   ?$i
   $TabPages = $System.TabPage()
   $TabPages.BackColor = $System.Color.FromName("Transparent")
   $TabPages.Text = $i
   $nul = $TabControl1.Controls.Add($TabPages)
Next
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Tue Jun 30, 2009 3:18 am    Post subject: Reply with quote

Hi Mart,

Take a look at this Link Dynamically added tabs it might give you some direction.

You could modify my loop like eriqjaffe's suggestion, not quite sure of your needs.

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Tue Jun 30, 2009 7:18 am    Post subject: Reply with quote

Thanks guys.
I used Ericís example (nice and simple) and it works great.

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Tue Jul 07, 2009 7:24 am    Post subject: Reply with quote

Eric's example is the best but the problem is you are trying to add an Integer variale ($i) to a string. That doesn't work in kix unless you do a CSTR() first.
_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group