Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can i show field captions using moverlist
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00951082
Message ID:
00951300
Views:
8
Hi Soykan,

I am glad You solved Your problem,

Here it is a simple code that gives You a start:
(Unfotrunately I can's esend You here the visual type of the form so I send it as a class)
oForm = CREATEOBJECT("Form1")
oForm.Show()
READ EVENTS


**************************************************
*-- Form:         form1 (d:\all_zapl\test.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   10/14/04 10:34:03 AM
*
DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	DIMENSION acaption[1]
	DIMENSION atables[1]


	ADD OBJECT list1 AS listbox WITH ;
		RowSourceType = 5, ;
		RowSource = "thisform.aCaption", ;
		Height = 207, ;
		Left = 15, ;
		Top = 28, ;
		Width = 151, ;
		Name = "List1"


	ADD OBJECT combo1 AS combobox WITH ;
		RowSourceType = 5, ;
		RowSource = "thisform.aTables", ;
		Height = 24, ;
		Left = 15, ;
		Style = 2, ;
		Top = 2, ;
		Width = 151, ;
		Name = "Combo1"


	PROCEDURE fillcaptions
		LPARAMETERS cTable
		LOCAL nFields
		cTable = JUSTSTEM(cTable)
		SELECT 0
		USE (cTable) IN 0 ALIAS MyTest
		DECLARE thisform.aCaption[FCOUNT()]
		STORE "" TO thisform.aCaption
		TRY
		   DBGETPROP(cTable,"TABLE","Path")
		   FOR nFields = 1 TO FCOUNT()
		       cCaption = DBGETPROP(cTable+"."+FIELDS(nFields),"FIELD","Caption")
		       IF EMPTY(cCaption) && You forgot to put Caption in Your table
		          thisform.aCaption[nFields] = FIELDS(nFields)
		       ELSE
		          thisform.aCaption[nFields] = cCaption
		       ENDIF
		   NEXT
		CATCH && Free table
		   FOR nFields = 1 TO FCOUNT()
		       thisform.aCaption[nFields] = FIELDS(nFields)
		   NEXT
		ENDTRY
		USE IN MyTest
		thisform.List1.Requery()
	ENDPROC


	PROCEDURE Init
		STORE "" TO thisform.aCaption, thisform.atables
		dbc_path = ""
		DO WHILE EMPTY(dbc_path)
		   dbc_path = GETFILE("DBC","Choose database","Choose", 0, "Choose database")
		   IF .NOT. JUSTEXT(dbc_path) == "DBC"
		      dbc_path = ""
		      *** Inform here Your user
		   ENDIF
		ENDDO
		OPEN DATABASE (dbc_path)
		m_path = ADDBS(JUSTPATH(dbc_path))
		ADIR(thisform.atables, m_path+"*.DBF")
		thisform.Combo1.Requery()
	ENDPROC

	PROCEDURE Destroy
                  CLEAR EVENTS
        ENDPROC

	PROCEDURE combo1.InteractiveChange
		thisform.FillCaptions(This.DisplayValue)
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform