hugorinen Member Licensed User Longtime User Mar 14, 2014 #1 Hi, I've got a simple question. I run this sub several times, and I want to get if there's already a panel at the location of the new panel (to avoid adding a new panel). Code: Copy Dim Left as int = 25dip Dim Width as int = 15dip Sub AddPanel(top as int, height as int) Dim p as panel 'Check here if a panel in Activity is already on the location Activity.AddView(p,Left,top,Width,height) End Sub My panels have the same left and width. Thanks in advance !
Hi, I've got a simple question. I run this sub several times, and I want to get if there's already a panel at the location of the new panel (to avoid adding a new panel). Code: Copy Dim Left as int = 25dip Dim Width as int = 15dip Sub AddPanel(top as int, height as int) Dim p as panel 'Check here if a panel in Activity is already on the location Activity.AddView(p,Left,top,Width,height) End Sub My panels have the same left and width. Thanks in advance !
thedesolatesoul Expert Licensed User Longtime User Mar 14, 2014 #2 You have to iterate through all the panels to see it. Something like Code: Copy Dim PanelFound as Int = 0 For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Panel Then If Activity.GetView(i).Left = Left AND Activity.GetView(i).Width = Width Then 'Dont add panel PanelFound = 1 End If Next If PanelFound = 0 Then Activity.AddView(p,Left,top,Width,height) End If Upvote 0
You have to iterate through all the panels to see it. Something like Code: Copy Dim PanelFound as Int = 0 For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Panel Then If Activity.GetView(i).Left = Left AND Activity.GetView(i).Width = Width Then 'Dont add panel PanelFound = 1 End If Next If PanelFound = 0 Then Activity.AddView(p,Left,top,Width,height) End If
hugorinen Member Licensed User Longtime User Mar 14, 2014 #3 Thanks, but actually I've to add some details. I've got like a row of panel (all the panels have same left and width, the only thing different is Height and top). When I add a panel, I want that if it's covering another panel, the covered panel and the panel to add have width /2. For example, Google do that in Google Agenda (picture attached). Sorry if it's not well explained. Best regards. Attachments Screenshot_2014-03-14-16-01-33[1].png 28.1 KB · Views: 432 Upvote 0
Thanks, but actually I've to add some details. I've got like a row of panel (all the panels have same left and width, the only thing different is Height and top). When I add a panel, I want that if it's covering another panel, the covered panel and the panel to add have width /2. For example, Google do that in Google Agenda (picture attached). Sorry if it's not well explained. Best regards.
thedesolatesoul Expert Licensed User Longtime User Mar 14, 2014 #4 Well I woudnt do it with this method then. I would rather first accumulate the data for that cell, and then decide the layout to show it in depending on the number of events. Upvote 0
Well I woudnt do it with this method then. I would rather first accumulate the data for that cell, and then decide the layout to show it in depending on the number of events.