Results 1 to 5 of 5

Thread: ListBox

  1. #1
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Unanswered: ListBox

    In a list box, you can determin whether it has a Title Row or not. Is there a way to change the Backcolor of that Title Row which contains the Fields' names.

    I think no.

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    I concur...although I suppose you could use a Label for the title header and set its' backcolor to whatever you like.



  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    You can do that, but what should you do if the record set of that always changes, and have different fields, it could have also a horizontal scroll bar, how can you achive that. Hope there is a way (just a property) to change that backColor.
    Thanks

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487

    Lightbulb

    You can simply change the label Name(s) to suit the new record set or data type (via code of course). Anything is possible

    I took a couple of minutes and put together the attched sample. In this sample there are two list boxes, each with a custom Header made from Labels. (you'll need to reference the DAO 3.6 Object Library)

    The first list box contains a pretty simple header made from one label.

    The second listbox contains a header with some additional functionality such as Sorting according to which header item is clicked upon. It contains several Labels. As the mouse passes over the Header Item title, it changes color indicating that it has focus (labels can't receive focus). As the mouse moves off the header, or to another Header item title the previous title changes back to its' original color and the title which the mouse is over now appears to gain focus. Click on any header item title and the contents of the list box is sorted according to which Header item was selected.

    Double-Click on any listed item will display the complete record for that item. I have also added a little sound effects to the header when clicked upon (just for the heck of it) and the mouse pointer changes to a hand with a pointing finger when passed over the header.

    This is most likely not what you are looking for but it only took a few minutes and I thought "what can it hurt...someone may benefit from the sample anyways."

    I'll kep my eyes open for a simple solution to changing the ListBox header backColor. There may be a way via API's.


    Attached Files Attached Files
    Last edited by CyberLynx; 06-26-04 at 05:55.

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Thank you CyberLynx for you nice example, certainly it does good work. It suits the List boxes with known fields, in my case the fields are not always the same, clearly you can type the fields names in the lable via VB, but what I can not do, when the fields excied the width of the list box, and a horizontal scroll bar appears, then I can not scroll the lable content to suite the content of each column.

    Thank you again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •