Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3804

Tab Panel for Runtime Generated new tabs with Listboxes

$
0
0

New to Xojo- first project. I am unintentionally abusing this coding effort.

The basic task is to create a runtime configurable UI for machine techs to configure equipment. The 1st phase code testing does the following:

  1. Application has a TabPanel.
  2. 1st panel is static data always accessible. Currently, it has a single button to create new tab panels.
  3. For each button press, a new tab is to be created and populated with a listbox (or grid view type object) to display data for the User to enter about the machine process.
  4. The listbox is configured to known dimensions

The new tab panels are generated, but listbox isn’t created at runtime by the AddNewControl method (generates compiler faults). I’ve read blog articles and tested various approaches, but I am obviously abusing this code. Here’s one of the code snippets which shows the basic goal:

’ add a tab panel for a new cabinet/solenoid cfg
var tabPanelCurrentCount As Integer = tabPanel_cabinetCfg.PanelCount
var tabPanelNextIdx As Integer = tabPanelCurrentCount + 1
var tabPanelLastCreatedPanel As Integer = 0

label_nextCabIdx.text = tabPanelNextIdx.ToString

tabPanel_cabinetCfg.AddPanel(“Cabinet #” + tabPanelNextIdx.toString)

// Create and configure the ListBox
var listBox_cabCfg As New Listbox
var i as integer = 0

listBox_cabCfg.ColumnCount = 21
for i = 1 to 49
listBox_cabCfg.AddRowAt(i, i.toString)
next i

'listBox_cabCfg.RowCount = 49
listBox_cabCfg.HasHeader = True
listBox_cabCfg.Width = Me.Width - 20 // Adjust with window size
listBox_cabCfg.Height = Me.Height - 40
listBox_cabCfg.Left = 10
listBox_cabCfg.Top = 10

tabPanelLastCreatedPanel = tabPanel_cabinetCfg.LastAddedPanelIndex
if tabPanelLastCreatedPanel <> 0 then
tabPanelLastCreatedPanel.AddControl(listBox_cabCfg)
Me.AddControl(listBox_cabCfg)
end if

I could use a hint or push in the right direction… Thanks

10 posts - 6 participants

Read full topic


Viewing all articles
Browse latest Browse all 3804

Trending Articles