Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you add code in gotfocus for dynamic built grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01409625
Message ID:
01409767
Vues:
47
>Nick,
>
>Without going into much details, I think in your case you would be much better using a special textbox class with your logic incorporated rather than attempting BindEvent.
>
>Please check my yesterday's message with a pointer to a FAQ as to how to add controls to a grid in run-time.
>
>>>>cool. I got to the value using AEVENT, but it seems to give me the value of the first row in the grid. What if I am trying to get the value of lets say 4th row in the grid? When I click on 4th row, it seems like the gotfocus is capturing the first row value not the correct clicked 4th row.
>>>
>>>When you're working with the grid, you may use Table.Field directly in your code, it's better than using textbox.value.
>>>
>>>What exactly you're trying to achieve, BTW?
>>
>>
>>I have 2 grids on a form. Whenever a user change values in grid number 2, I want that change to reflect in grid number 1. For my grid number 2, I am creating a cursor first that populated with data. Then I build a dynamic grid setting the columns and properties. next I am trying to capture a value being changed in the grid (lets say column 4 row 3). If the value changes, I am using gotfocus to see if they entered same value or new value. Then when they lostfocus on that cell in the grid, I update a table and refresh grid number 1.
>>
>>
>>	lc_locid = .a
>>	REQUERY('lv_view_consume_history')
>>	SELECT * from crs_consumer_history INTO CURSOR crs_grid3 READWRITE 
>>	INSERT INTO crs_grid3 (crschdate, crschinit, crsprod, crshowmuch, crsorderno, crsconsumer) ;
>>		SELECT ch_date, ch_initials, p_productname, ch_howmuch_consumed, ir_orderno, ch_consumer FROM lv_view_consume_history
>>	SELECT crs_grid3
>>	GO Top 				
>>		.g3.RecordSource="crs_grid3"
>>		.g3.RecordSourceType = 1
>>		.g3.ColumnCount=6
>>		.g3.readonly = .f.		
>>		*.g3.LockColumns = 4		
>>		.g3.Refresh()
>>		WITH .g3	
>>			.HeaderHeight = 30		&&*thisform.g3.Columns.header.wordwrap = .t.
>>			.SetAll('WordWrap',.t.)   &&thisform.g3.Column.Header.WordWrap = .T.
>>			.column1.header1.caption = "Date"
>>			.column1.header1.ToolTipText = 'Date of order'		
>>			.column1.width = 75
>>			.column1.Enabled = .F.
>>			.column1.Text1.DisabledBackColor 	= RGB(255,255,255)
>>			.column1.Text1.DisabledForeColor = RGB(0,0,0)
>>			.column1.ControlSource = "crs_grid3.crschdate"
>>
>>...
>>
>>			.column4.header1.caption = "How Much"
>>			.column4.header1.ToolTipText = 'How much consumed'		
>>			.column4.width = 61	
>>			.column4.Enabled = .t.
>>			.column4.Text1.DisabledBackColor 	= RGB(255,255,255)
>>			.column4.Text1.DisabledForeColor = RGB(0,0,0)	
>>			.column4.controlsource = "crs_grid3.crshowmuch"
>>....
>>
>>		ENDWITH
>>		.g3.Refresh()
>>		BINDEVENT(thisform.g3.column4.Text1 ,[GotFocus], thisform, [gotfocus_msg],1)
>>
>>
>>
>>I am taking approach because I still kept having issues with view not commiting. I have alway used this method to create my grids, but this is first time I have needed to capture values using gotfocus and lostfocus using bindevent. Most of the time I have a command button to save changed values. Thanks. ...Nick.

Thanks for all your help Naomi. I will use the textbox class approach you mentioned, the current method is getting too complex for my level of programming. Again, yours and Sergey's input is alway valuable.

Nick.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform