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

Check list box in VFP?

Status
Not open for further replies.

handoko

Technical User
Apr 18, 2003
24
0
0
ID
Hi,
How i can make a list box with check box in the list?
example:
[x] A
[x] B
[ ] C

thanks you.
 
Thank you Mike,
But i have problem using the column width.
I use a table consist of one field "Language".
When I run the form it shows like this:
-----------------------------------
| Language | | |
-----------------------------------
|[ ]English | |SB|
|[ ]Japanese | |SB|
------------------------------------

My problems are:
1. I try to set the column width but no response
The right column still showing.
When I put focus to this checklist box, the right
column is disappear.
2. Vertical ScrollBar is missing. Eventough the record row
is greater than height of component row


Once again, thanks for your attention.


 
HANDOKO

What are you using? ListView, listbox or a grid? If it is a regular listbox, here is an example. You set you column count, and you column width and everything lines up:
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	ADD OBJECT list1 AS listbox WITH ;
		FontName = "Courier New", ;
		ColumnCount = 2, ;
		ColumnWidths = "80,20", ;
		RowSourceType = 5, ;
		RowSource = "myList", ;
		Height = 193, ;
		ColumnLines = .T., ;
		Left = 48, ;
		Top = 24, ;
		Width = 156, ;
		Name = "List1"
	PROCEDURE Load
		PUBLIC ARRAY myList[2,2]
		STORE "English" TO mylist[1,1]
		STORE "Japanese" TO mylist[2,1]
		STORE "SB" TO mylist[1,2]
		STORE "SB" TO mylist[2,2]
	ENDPROC
ENDDEFINE


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I use Mike Lewis's "Simplelist" ListView, not a regural Listbox.

thanks




 
handoko

Are you using a cursor or a table to propulate the SimpleList?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yes, I use table "Language". With Only one Field "Language"

PS: 'SB'=Scroll Button, not item from the list
 
Are you using the line separators? What happens when you take the off?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
There's no line separator property in Mike Lewis Component.
I'll try to ask him.

thanks anyway
 
Hi Handoko,

Sorry I didn't see your message earlier.

Can you tell me what value you are setting the ColumnWidth property to? Also, what is the Width property of the SimpleList on your form?

If you can give me that information, I will try to reproduce the problem, and report back.

Mike


Mike Lewis
Edinburgh, Scotland
 
Hi, Mike Lewis

I'd mail my question to you directry. Thanks for your response.

I think I found the problem. The width and height of Simplelist must greater than the white rectangle inside the simplelist.

But, I have a deadline, so I manipulate a grid look like check list box(Suggestion from Mike Gagnon).

Once again.
Thank you very much.
 
This is very easy to do in VFP.

First, You need two graphics, one with a box that is checked and one that isn't. If you search all the graphics files and sample folders that ship with VFP, you'll find them.

Second, if you look at the native VFP listbox, you'll see there is a Picture property. You can address this property individually for each item in the list box, like an array. For example:

ListBox.Picture(1) = "Checked.BMP"
ListBox.Picture(2) = "Unchecked.BMP"



Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
Handoko,

I'm glad you solved it. Those width properties are always a bit of a problem. I usually have to use trial-and-error to get them right. I'll try to fix it in the control one day.

The grid is a possible alternative to the SimpleList. It has the advantage of being able to support a very large number of records. Craig's code should get you started.

Mike

Mike Lewis
Edinburgh, Scotland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top