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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image, list box and Max screen problem 1

Status
Not open for further replies.

taterday

Programmer
Jan 28, 2009
183
US
I have a list box that displays the items bought for a specific part (9 max). The user was having problems reading across the list box and keeping his place, so I put a picture in the attribute to increase the white space. Doesn't help to remove this. Problem still exists.

There is an image on the left of the list box that is lined up with each line item. The problem is when they Max the form, horizonally it is fine with headings, etc; but vertically the image does not align with the item. The image is down further on the form. I have tried anchor, may not be using it correctly.

Each image is expands vertically more than there counterpart the line item. How to get the items in the list box items to grow?

Thank you for any help.


 
I personally do not use list boxes.. i use grids instead.

you have way more control of the display, the headers, the font of each record, the size of each row, you have better dynamic fonts and coloring etc..

also you can easily do the resizing when the form is stretched.

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
Taterday,

If your main reason for adding the images is to help the user "reading across the list box and keeping his place", then I completely agree with Ali: You should be using a grid. Forget the pictures. Instead, apply a different background colour to alternating rows (using DynamicBackColor). That'll make the grid much easier to read, however large it is.

That said, I don't really understand how adding the pictures to a listbox would help the user read the list. If you've got some other reason for adding the images, that would be another reason for using a grid. You can place an image control directly in a grid column, and there won't be any problems with resizing.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
I am stuck with the list box. This has been approved and functioning and there is alot of them through out the system.

Are there anyway to conrol the images on the left of the listbox? I have the stretch class on the screen with some modification in the resize event now. I redo the list box stretch across. Works.

thanks
 
Perhaps you could explain exactly what function these pictures serve. How do they help the user to read the grid, as you originally stated?

Also, do you want each individual image to resize when you resize the form? Or do you want to keep them the same size, but move them vertically so that they continue to be aligned with the listbox rows?

For that matter, why do the individaul rows in the listbox change height when you resize the form vertically? That's not the default behaviour. Have you got some code somewhere that somehow changes the row height (I can't imagine how that would work)?

Finally, what is the "stretch class"?

We're very happy to help you if we can, but you need to be clearer in explaining the problem.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
The listbox row says what they have purchased and the image represents the part. It aligns great as long on they don't max.

Question: For that matter, why do the individaul rows in the listbox change height when you resize the form vertically? Answer: they don't. That is problem. The image on the left does. It moves down away from its line item.

Question: Or do you want to keep them the same size, but move them vertically so that they continue to be aligned with the listbox rows? Problem: Absolutely want them to align. The list items are where they were. The images go down.

Finally, what is the "stretch class"? very old code from fox 2.5. Sorry I mentioned it.



 
OK, it's getting a bit clearer. If I've understood it right, you're saying that the images start out aligned to the individual rows in the listbox. When you resize the form, the images move downward, so that they are no longer aligned.

The solution to that would be to adjust the Anchor property of the images. You probably want them to be anchored absolutely to the top edge (Anchor value = 1). But that depends on how the listbox itself is anchored. If there is any other code that is causing the images to move, you need to remove that, or, at least, fix it so that it doesn't affect the images.

If you are not familiar with the Anchor property, the best bet is to use the Anchor Editor. Click on Anchor in the Properties window, then click the "three dots" button to the right of the box (at the top of the Properties window) that shows the property value. The Anchor Editor will let you choose from common pre-sets, and it gives you a preview so that you can see the effect of each setting.

But I still don't understand how the picture relates to the individual items in the listbox. Even if you succeed in keeping the pictures aligned with the listbox as a whole, they won't stay aligned when the user scrolls the listbox.

Just remind me why you can't use the listbox's Picture property? It seems this would solve all the problems. If you're not sure how to do that, the Help file has a topic named "How to: Add Pictures to Items in a List".

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Are you using images seperate from the listbox? Or the images of list items? I really don't understand what you describe in thousand words, could you show a screenshot?
Is it your resize code changes font size? The normal anchor/resize will just change the listbox overall size, but not change font size, therefore item height will stay and you will just see more items, if there are.

The simplest solution might be to simply anchor the position of two sides and keep the size as is. Otherwise you will have to change both font size and image size.
MS decided item images don't stretch, indeed all interior also of grid doesn't resize by anchroing. And I am thankful for that. You just see more data by resizing the listbox/grid/editobx area. If icons stretch, that looks awfully ugly. It's bad enough with pictures.

Bye, Olaf
 
I will really like to get you suggestion of putting the image in the picture attribute. I do not know how.

Question: Are you using images seperate from the listbox? yes I will look into changing this. I did not think I could because images are on the disk and are placed in the empty boxes to the left of the list box. The list box will be full if they pick the max of 9 items and does not scroll. The list box is populated with a cursor, sql command.

The image (picture) in list box is blank and used only as a spacer to create more white space.

I tried the 1 in the archor and it did not seem to help. I will have to further investigate whatelse is my problem. I know that the list box increases in size vertically but the record items within the listbox do not. The listbox does, however. Is this normal for a list box. If not, it must be some old code in the resize event.

THIS.(iItem) = IIF("]" $ cExtension, ; "", "textfile.bmp") how can I adapt this code. I have a folder that contents all available images. It said the code is in the click event. That would be the only time the "this.(item) would work?

I have code that works to retrieve the image into the separate boxes and to retrieve the image for printing.

Thank you,


 
Mike,
I got the list box to have individual images and it works. Thank you for steering me to the How to add pictures to a listbox. I did not know about this in the help file. When I tried to add pictures in the past they would all be the same picture. Again thank you.

My problem has been SOLVED.

P.S. I also used the anchor advise.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top