Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use question
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
How to use question
Miscellaneous
Thread ID:
00677133
Message ID:
00677133
Views:
69
I have a pageframe with three pages. The first page has actual set of controls on it. The second and third pages, after design, I saved them as a class an create them when the page is first shown. Each page has a series of activex controls (bblistview) used for displaying and capturing user data. I use the following code in the click event of each activeX:
thisform.updatelist(nRowIndex,nColumnIndex,bonPicture,this,'co_pat_ID','pat_ID_ID')
I simply have to modify the last two values for each activeX.

The code for the updatelist() is:
PARAMETERS nRow,nCol,bonPicture,oObjectName,ctable,cfield
IF nCol=2 AND bonPicture
	lnID=VAL(oObjectName.LISTITEM(nRow,3).Text)
	
	IF allt(oObjectName.LISTITEM(nRow,2).Text)='1'
	    *----------------------------------------------------------------------------------------------*
	    * Record is set to true, change to false
	    *----------------------------------------------------------------------------------------------*
		oObjectName.LISTITEM(nRow,2).Text='0'
		lnID=VAL(oObjectName.LISTITEM(nRow,3).Text)
		lcCmd=[Update ]+ALLTRIM(cTable)+[ set answerflag = 0 where ]+cField+[ =?lnID]
		IF SQLEXEC(gnConnHandle,lcCmd)<1
			=sqlerror()
		endif
	ELSE
	    *----------------------------------------------------------------------------------------------*
	    * Record is set to false, change to true
	    *----------------------------------------------------------------------------------------------*
		oObjectName.LISTITEM(nRow,2).Text='1'
		lnID=VAL(oObjectName.LISTITEM(nRow,3).Text)
		lnRecordID=VAL(oObjectName.LISTITEM(nRow,4).Text)
	    *----------------------------------------------------------------------------------------------*
	    * Check to see if we have had a record here already, if so, we update, otherwise we insert
	    *----------------------------------------------------------------------------------------------*
		IF lnID=0
			lnRecordID=VAL(oObjectName.LISTITEM(nRow,4).Text)
			* Insert New Record Into Table
			lcCmd=[Insert into ]+cTable+[  (meetingnumber,recordid,answerflag) values (?gnMeetID,?lnRecordID,1) ]
			IF SQLEXEC(gnConnHandle,lcCmd)<1
				=sqlerror()
			ELSE
			    *----------------------------------------------------------------------------------------------*
			    * We need to get the Need ID that was assigned in case the user unclicks this record
			    *----------------------------------------------------------------------------------------------*
				IF SQLEXEC(gnConnHandle,[select @@Identity as xNewID]) < 1
					=sqlerror()
				ELSE
					oObjectName.LISTITEM(nRow,3).Text=ALLTRIM(STR(sqlresult.xNewID))
				ENDIF 
			ENDIF
		ELSE
			lcCmd=[Update ]+cTable+[ set answerflag = 1 where ]+cfield+[ =?lnID]
			IF SQLEXEC(gnConnHandle,lcCmd)<1
				=sqlerror()
			ENDIF
		ENDIF 
	ENDIF
	oObjectName.listitem(nRow,2).pictureindex=IIF(ALLTRIM(oObjectName.LISTITEM(nRow,2).Text)='0',15,16)
ENDIF
This all works great on the first page. The question is how to I call reference the object for page 2 and 3 since they are an object also? Here is how I create the object for the second page:
SET CLASSLIB TO tenca addi
thisform.LockScreen=.t.
if !type("this.page2o")="O"
  this.NewObject("page2o","tenca_page2_io")
  this.Page2O.visible = .t.
endif
thisform.LockScreen=.f.
Thanks for any pointers

Kirk
Next
Reply
Map
View

Click here to load this message in the networking platform