|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Control Container Property - Why Use It?For example: '-------------------------------- 'Use Placeholder to hold ComboBox '-------------------------------- 'Place cboText on tbrPlaceholder Set btnX = .Buttons.Add(, "phcombo", , tbrPlaceholder) '------------------------------------- 'Associate any tbrPlaceholder controls with the Toolbar '------------------------------------- Set cboText.Container = Toolbar1 Toolbar1.Buttons("phcombo").Width = cboText.Width My understanding this identifies Toolbar1 as being the container for the combobox. So what? --With or without the combobox functions as it should. --The combobox doesn't show up under object browser Toolbar1 Anyone have an explanation why it should be used? Thanks David "David" <dw85745***@earthlink.net> wrote in news:eEox$YynJHA.4872 @TK2MSFTNGP04.phx.gbl:Show quoteHide quote > I don't see the benefit or really purpose of the Container property. I've always used the SetParent API.> > For example: > > '-------------------------------- > 'Use Placeholder to hold ComboBox > '-------------------------------- > 'Place cboText on tbrPlaceholder > Set btnX = .Buttons.Add(, "phcombo", , tbrPlaceholder) > '------------------------------------- > 'Associate any tbrPlaceholder controls with the Toolbar > '------------------------------------- > Set cboText.Container = Toolbar1 > Toolbar1.Buttons("phcombo").Width = cboText.Width > > My understanding this identifies Toolbar1 as being the container for the > combobox. > > So what? > --With or without the combobox functions as it should. > --The combobox doesn't show up under object browser Toolbar1 > > Anyone have an explanation why it should be used? For instance, maybe you would want to provide sub-item editing on a VB listview in report mode. You *could* do this by setting the Parent of a TextBox to be the listview (using the .Container property of the textbox doesn't work with a LV, but SetParent does). Set the textbox not visible, and when a subitem is clicked/dbl-clicked, you can then use GetSubItemRect to set the location and size of the textbox, then make it visible. DanS thanks for response.
So it appears you use SetParent in lieu of Container. So back to base question -- what good is Container? Show quoteHide quote "DanS" <t.h.i.s.n.t.h.a.t@r.o.a.d.r.u.n.n.e.r.c.o.m> wrote in message news:Xns9BC75CBEAD57Bthisnthatroadrunnern@85.214.105.209... > "David" <dw85745***@earthlink.net> wrote in news:eEox$YynJHA.4872 > @TK2MSFTNGP04.phx.gbl: > >> I don't see the benefit or really purpose of the Container property. >> >> For example: >> >> '-------------------------------- >> 'Use Placeholder to hold ComboBox >> '-------------------------------- >> 'Place cboText on tbrPlaceholder >> Set btnX = .Buttons.Add(, "phcombo", , tbrPlaceholder) >> '------------------------------------- >> 'Associate any tbrPlaceholder controls with the Toolbar >> '------------------------------------- >> Set cboText.Container = Toolbar1 >> Toolbar1.Buttons("phcombo").Width = cboText.Width >> >> My understanding this identifies Toolbar1 as being the container for > the >> combobox. >> >> So what? >> --With or without the combobox functions as it should. >> --The combobox doesn't show up under object browser Toolbar1 >> >> Anyone have an explanation why it should be used? > > I've always used the SetParent API. > > For instance, maybe you would want to provide sub-item editing on a VB > listview in report mode. You *could* do this by setting the Parent of a > TextBox to be the listview (using the .Container property of the textbox > doesn't work with a LV, but SetParent does). Set the textbox not visible, > and when a subitem is clicked/dbl-clicked, you can then use > GetSubItemRect to set the location and size of the textbox, then make it > visible. "David" <dw85745***@earthlink.net> wrote Add two Frame controls and place a Checkbox on one of the frames.> I don't see the benefit or really purpose of the Container property. Paste in the code below and run the program. Click the Checkbox a few times.... LFS Private Sub Check1_Click() If Check1 Then Set Check1.Container = Frame1 Else Set Check1.Container = Frame2 End If End Sub Thanks Mr. Serflaten.
Nice simple example. I get it -- guess never had a need to really use it. Thanks for input. David Show quoteHide quote "Larry Serflaten" <serfla***@usinternet.com> wrote in message news:%23LpaOM1nJHA.5420@TK2MSFTNGP04.phx.gbl... > > "David" <dw85745***@earthlink.net> wrote >> I don't see the benefit or really purpose of the Container property. > > Add two Frame controls and place a Checkbox on one of the frames. > Paste in the code below and run the program. Click the Checkbox > a few times.... > > LFS > > Private Sub Check1_Click() > If Check1 Then > Set Check1.Container = Frame1 > Else > Set Check1.Container = Frame2 > End If > End Sub > > > > >
Determining Available Paper Sizes on Printer
Problem with syntax Scrollbars on Textbox -- how can I hide them? vb6 closes with erro after I installed msdn oct 2001 Error #429 and compactdatabase in VB6 ListBox bug? Excel Library in VB 2008 on 64-bit OS installation Using VBPRNDLG.DLLl Instead of Print Common Dialog Boxes VSM Wants Your Feedback Get My Pictures Back |
|||||||||||||||||||||||