New topic: 

Programmatically add controls

<http://forums.realsoftware.com/viewtopic.php?t=41034>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        DaKaron          Post subject: Programmatically add 
controlsPosted: Mon Oct 17, 2011 8:18 am                         
Joined: Mon Oct 17, 2011 7:35 am
Posts: 2                hi all,

i'm new to REALBasic, i'm trying to read some data from a database then add a 
label and other controls (a listbox and a checkbox) for each record found in 
the database.

My problem is that i've the code that should add the controls, REALBasic build 
it without return any error, but the labels doesn't appear... i've cheched that 
the recordset contain some data and the loop work correctly.

here is the code:

Code:  dim dr As DatabaseRecord
  dim sql As String
  
  sql = "SELECT * FROM pack WHERE applicabilita_modello LIKE '%" + versione + 
"%'"
  
  dim rs As RecordSet = database.SQLSelect(sql)
  
  dim i As Integer = 1
  dim test(10) As Label
  while not rs.EOF
  
  test(i) = new Label
  
  test(i).Parent = ContentPageController
  test(i).Text =  rs.Field("descrizione").StringValue
  test(i).Left = 20
  test(i).Top = 50 * i
  test(i).Enabled = true
  test(i).Visible = true
  
  rs.MoveNext
  
  i = i + 1
  
  wend
  
  rs.Close


thanks for any help   
                             Top                 ivanomonti          Post 
subject: Re: Programmatically add controlsPosted: Mon Oct 17, 2011 8:44 am      
                   
Joined: Mon Nov 03, 2008 6:36 am
Posts: 382
Location: Italia > Milano > Solaro                rb not create object at 
runtime, so if you want to have you create a dynamic label in physical form 
with index 0

then you can increase index with append and then see how you


DaKaron wrote:hi all,

i'm new to REALBasic, i'm trying to read some data from a database then add a 
label and other controls (a listbox and a checkbox) for each record found in 
the database.

My problem is that i've the code that should add the controls, REALBasic build 
it without return any error, but the labels doesn't appear... i've cheched that 
the recordset contain some data and the loop work correctly.

here is the code:

Code:  dim dr As DatabaseRecord
  dim sql As String
  
  sql = "SELECT * FROM pack WHERE applicabilita_modello LIKE '%" + versione + 
"%'"
  
  dim rs As RecordSet = database.SQLSelect(sql)
  
  dim i As Integer = 1
  dim test(10) As Label
  while not rs.EOF
  
  test(i) = new Label
  
  test(i).Parent = ContentPageController
  test(i).Text =  rs.Field("descrizione").StringValue
  test(i).Left = 20
  test(i).Top = 50 * i
  test(i).Enabled = true
  test(i).Visible = true
  
  rs.MoveNext
  
  i = i + 1
  
  wend
  
  rs.Close


thanks for any help      
_________________
>>>>  Boys, also accept small donations for my continuous study for my and your 
>>>> mailinglist  <<<<

MacBookPro 17p - 3.06 ghz - 8 gb OSX Lion
REALStudio 2009/2010/2011
Custom controls and classes for RealStudio ( no plugin )
kClass, class for desktop
wClass, class for Web
http://www.ivanomonti.eu  
                             Top                 mjh          Post subject: Re: 
Programmatically add controlsPosted: Mon Oct 17, 2011 8:47 am                   
              
Joined: Sun Feb 19, 2006 3:10 pm
Posts: 1523
Location: Hamburg, Germany                It’s documented here: 
http://docs.realsoftware.com/index.php/UsersGuide:Chapter_5:Creating_New_Instances_of_Controls_On_The_Fly.
      
_________________
Michael J. Hußmann 
http://digicam-experts.de  
                             Top                DaKaron          Post subject: 
Re: Programmatically add controlsPosted: Mon Oct 17, 2011 10:26 am              
           
Joined: Mon Oct 17, 2011 7:35 am
Posts: 2                thanks you very much    
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to