Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox header row

Status
Not open for further replies.

glamb

Programmer
Dec 29, 2009
32
US
Does anyone know how to get the field names as the header for a listbox? I want the user to be able to scroll across the listbox and know what field values they are looking at.
 
Yes, except the code has already been written and involves two listboxes where the user can move a row back and forth from one listbox to the other. I didn't know they wanted all row fields and so have a stationary header for each listbox. I would have to re-write the whole thing to put it in two grids.
 
Glamb,

What do you mean by a "header for a listbox"? Listboxes don't have "headers".

Do you mean you want to display some text just above the listbox? If so, place a label on the form and set its caption to the required text.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Yes, that is the problem, that there is no "header". How do I make a horizontally scrolling "header" for the columns in the listbox so the user will know what field values they are looking at?
 
I follow you, and it's not easy.

The closest you could probably get is to fix you 'headers' in the first and last records that fill the list box and make those two entries disabled.

They will look slightly different, and will scroll out of the visible area - but it's that or rewrite using grids!

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Use a grid. You are describing a moverlist. Check foxyclasses' MoverListXX class to get an idea how it would work. It uses grids.

Cetin Basoz
MS Foxpro MVP, MCP
 
Wouldnot it be most easy to extend the listboxitems with the requested additional (field) information (extra column)?
As suggested before a label can easily display the content of the selected listboxitem.
hth
-Bart
 
No, a grid would be most easy. OTOH easy is a relative term.

Cetin Basoz
MS Foxpro MVP, MCP
 
If Glamb already has a functioning listbox, and the only feature missing is the headers, the easiest solution would be to place a set of labels at the top of the grid - one label above each column.

But for anyone starting from scratch, a grid would be a better choice.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike,

there is the extra task of having labels over the listbox that would move, if you scroll horizontally (right<->left), as the listbox is not wide enough to hold all columns.

As it's a mover with two listboxes a solution might be to not put these two listboxes side by side but one underneath the other. Then you might have enough space horizontally to have simple fixed labels over all the columns.

Otherwise, yes, the simple task of scrolling headers is most easily achieved by a grid.

By the way I have designed such a control class with the UI Sepereated from the rest of the logic, so it does not matter much, if I use a listbox or grid. The only foundation is having two cursors options and selections, methods that move options to the selections cursor or vice versa and the UI is just blindly showing the cursors.

If you also separated your coding logic that way it should be quite easy to switch from listboxes to grids.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top