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

AfterRowColChange and select Value from Grid

Status
Not open for further replies.

sashaDG

Programmer
Jun 20, 2022
112
BY
Hello, I have a question that I can't solve.
There is Grid, TextBox.In the TextBox, I can enter values, a search occurs in TextBox.InteractiveChange(everything works here).
After searching, a record in the grid is highlighted.

Created a function in grid.AfterRowColChange: by clicking on the cell n of the column and m of the row, the value is transferred to the TextBox.(Everything works)

Code:
ValueField = ThisForm.grid1.value
ColumnActive = ThisForm.grid1.ActiveColumn

GetFieldValue(ThisForm, ValueField)

FUNCTION GetFieldValue(myform, fieldGrid)
SelectCaption = 'myform.Grid1.column'+ALLTRIM(STR(columnactive))+'.header1.Caption'
	 DO CASE   
	 	CASE &SelectCaption == 'case1'
	 	 	myform.sNaim.value = (fieldGrid)
			InputN = (fieldGrid)
		CASE &SelectCaption == 'case2'
	 	 	myform.sKpost.value = (fieldGrid)
			InputKP = (fieldGrid)
		CASE &SelectCaption == 'case3'
	 	 	myform.sOdse.value = (fieldGrid)
			InputOdse = (fieldGrid)
		CASE &SelectCaption == 'case4'		
	 	 	myform.sOdse.value = (fieldGrid)
			InputOdse = (fieldGrid)														
 	ENDCASE 
ENDFUNC

Troubles occur when clicking on a field in the Grid, the value enters the TextBox (ProgrammaticChange is triggered). Then I change the value in the TextBox, InteractiveChange fires and the Grid changes. The best match is at the top and HIGHLIGHTED

Then I click on another line and AfterRowColChange is triggered AND the value that was in the top goes to the TextBox and I moved to the place that I clicked on

There was such an error when I cleared the TextBox and the Grid accepted the Source Table, then I transferred the focus (ThisForm.Grid1.column8.text1.Setfocus) and everything worked. I understand that this is a crutch, at that time I didn’t come up with anything better

It's strange, but if this sequence of actions is carried out twice, then the TextBox does not change the second time.
 
Hi Sasha,

sashaDG said:
Because I take values from some columns in the TextBox, but I don’t take values from the first column.
Now that makes sense.

sashaDG said:
I did not create a custom class, "View Parent Code" is disabled for me everywhere.
Thanks for checking.

sashaDG said:
I used debugging, but it did not help.
Yes, with focus issues that's often not able to find what causes it. Good to see you're using this.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top