New topic: Positioning dynamic controls
<http://forums.realsoftware.com/viewtopic.php?t=47294> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message ojan Post subject: Positioning dynamic controlsPosted: Fri Mar 15, 2013 4:45 am Joined: Fri Oct 16, 2009 12:05 pm Posts: 22 Location: Denmark Hi My app is generating dynamic controls (WebImageViews and Labels) based on a XML file to show some thumbnails. I never know how many controls that will be generated so I need a smart way of distributing the thumbnails on the webpage. In the opening event of the webpage my app runs this code: Dim f As FolderItem f = GetFolderItem(WebPage1.XMLFileField.text) Dim MediaFiles as New XmlDocument MediaFiles.LoadXml(f) dim nameNodes as XMLNodeList = MediaFiles.documentElement.xql("//item/name") for i as integer = 0 to nameNodes.Length-1 dim thumb1 as ThumbClass = self.AddThumbClass1 thumb1.left = thumb1.Index * 148 thumb1.Top = 80 thumb1.Visible = True thumb1.file = nameNodes.item(i).FirstChild.Value Dim picFile As New FolderItem("C:\MediaFiles\thumbs\" + nameNodes.item(i).FIrstChild.Value + ".jpg") If picFile <> Nil And picFile.Exists Then Dim myPic As New WebPicture(picFile) thumb1.Picture = myPic End If dim thumbLabel1 as thumbLabel = self.AddthumbLabel thumbLabel1.left = thumbLabel1.Index * 148 thumbLabel1.Top = 160 thumbLabel1.Visible = True thumbLabel1.text = nameNodes.item(i).FIrstChild.Value next As you can see I'm using a offset on the "Left" thumb1.left = thumb1.Index * 148 - but I would like the thumbs to be distributed on the page in rows and columns. Any ideas on some smart logic for this? Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- 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]
