[comp.windows.ms.programmer] List boxes and Edit Windows - Common problem

bam@cs.arizona.edu (Brett Alan Morrison) (06/12/91)

Two questions:

Does anyone out there know how to justify text in a list box?  Like this:

------------------------------
|Item one 05/02/91           |    Any suggestions?  My problem is that
|Another item 05/02/91       |    everything is proportianally spaced.
|I wan't this        05/02/91|
|And this            05/02/91|
|                            |
------------------------------

Also, are there any generic routines out there for validating a numeric in
a one line edit window?  If the user enters a non-numeric character, I want
the bad character(s) to be highlighted and the cursor placed at the beginning.
This is a common method used by applications, but I'm not sure of the best
way to do it.

Thanks,

Brett A. Morrison
bam@cs.arizona.edu

kshafer@tortuga.SanDiego.NCR.COM (Keith Shafer) (06/12/91)

In article <1565@caslon.cs.arizona.edu> bam@cs.arizona.edu (Brett Alan Morrison) writes:
>Does anyone out there know how to justify text in a list box?  Like this:
>
>------------------------------
>|Item one 05/02/91           |    Any suggestions?  My problem is that
>|Another item 05/02/91       |    everything is proportianally spaced.
>|I wan't this        05/02/91|
>|And this            05/02/91|
>------------------------------

In the resource file make sure the list box has the LBS_USETABSTOPS style
and then separate the fields in the string with tabs.  I always used the
default tab stops but these can be set by sending the LB_SETTABSTOPS message
to the dialog box.  For information, see the SDK Reference Book 1 page 6-44
and the SDK Reference Book 2 page 8-43.

>Thanks,
>
>Brett A. Morrison
>bam@cs.arizona.edu

- Keith

-----
Keith.Shafer@SanDiegoCA.NCR.COM