Dialog with list box? - Programmer

This is a discussion on Dialog with list box? - Programmer ; Hi, I have a list box in a dialog, I've selected the necessary options to make it multicolumn but where in code to I put the SetTabStops function call? I've tried it in ::OnCreate but it just crashes. Thanks, Paul...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Dialog with list box?

  1. Dialog with list box?

    Hi,

    I have a list box in a dialog, I've selected the necessary options to make
    it multicolumn but where in code to I put the SetTabStops function call?
    I've tried it in ::OnCreate but it just crashes.

    Thanks,

    Paul



  2. Re: Dialog with list box?

    paul wrote:
    > Hi,
    >
    > I have a list box in a dialog, I've selected the necessary options to make
    > it multicolumn but where in code to I put the SetTabStops function call?
    > I've tried it in ::OnCreate but it just crashes.
    >
    > Thanks,
    >
    > Paul
    >
    >


    You question assumes a lot and leaves out a lot. SetTabStops appears to
    be an MFC function. If you are dealing with an MFC CDialog class the
    answer is that you can call the list box control's SetTabStops in
    OnInitDialog, after it has called the base class OnInitDialog. This is
    the first point at which the underlying list box control has been created.

    But SetTabStops has nothing to do with multicolumn list boxes. A
    multicolumn list box is one in which the list items snake around, in
    newspaper-style columns. For example, the file list in the common file
    open dialog is a multicolumn list box.

    If you want to display multicolumn data you can use the list box
    SetTabStops (without the multicolumn style), although this will not
    right-align numeric columns. Or, you can use the more-suitable list
    control in report mode instead of the list box control.

    --
    Scott McPhillips [VC++ MVP]


  3. Re: Dialog with list box?

    Hi,

    In MSVC++ I have a dialog resource and create the files using the
    classwizard but there is no OnInitDialog. I'm trying to display some data in
    the list box using tabs or multi columns to make it easier to view the data.

    Thanks,

    Paul

    "Scott McPhillips [MVP]" wrote in message
    news:V_2dnVyGZbnqngjeRVn-tg@comcast.com...
    > paul wrote:
    >> Hi,
    >>
    >> I have a list box in a dialog, I've selected the necessary options to
    >> make it multicolumn but where in code to I put the SetTabStops function
    >> call? I've tried it in ::OnCreate but it just crashes.
    >>
    >> Thanks,
    >>
    >> Paul
    >>
    >>

    >
    > You question assumes a lot and leaves out a lot. SetTabStops appears to
    > be an MFC function. If you are dealing with an MFC CDialog class the
    > answer is that you can call the list box control's SetTabStops in
    > OnInitDialog, after it has called the base class OnInitDialog. This is
    > the first point at which the underlying list box control has been created.
    >
    > But SetTabStops has nothing to do with multicolumn list boxes. A
    > multicolumn list box is one in which the list items snake around, in
    > newspaper-style columns. For example, the file list in the common file
    > open dialog is a multicolumn list box.
    >
    > If you want to display multicolumn data you can use the list box
    > SetTabStops (without the multicolumn style), although this will not
    > right-align numeric columns. Or, you can use the more-suitable list
    > control in report mode instead of the list box control.
    >
    > --
    > Scott McPhillips [VC++ MVP]
    >




  4. Re: Dialog with list box?

    paul wrote:
    > Hi,
    >
    > In MSVC++ I have a dialog resource and create the files using the
    > classwizard but there is no OnInitDialog. I'm trying to display some data in
    > the list box using tabs or multi columns to make it easier to view the data.
    >
    > Thanks,
    >
    > Paul


    Using class wizard, add a message handler in the dialog for
    WM_INITDIALOG. The message handler is OnInitDialog and that's the place
    to initialize controls before they become visible.

    --
    Scott McPhillips [VC++ MVP]


  5. Re: Dialog with list box?

    Thanks for the help, it works now.

    Paul

    "Scott McPhillips [MVP]" wrote in message
    news:rv6dnWA7wcM-AgjenZ2dnUVZ_sOdnZ2d@comcast.com...
    > paul wrote:
    >> Hi,
    >>
    >> In MSVC++ I have a dialog resource and create the files using the
    >> classwizard but there is no OnInitDialog. I'm trying to display some data
    >> in the list box using tabs or multi columns to make it easier to view the
    >> data.
    >>
    >> Thanks,
    >>
    >> Paul

    >
    > Using class wizard, add a message handler in the dialog for WM_INITDIALOG.
    > The message handler is OnInitDialog and that's the place to initialize
    > controls before they become visible.
    >
    > --
    > Scott McPhillips [VC++ MVP]
    >




+ Reply to Thread