Page 1 of 1

This ThisWindow Parent how to use in on key procedure in grid

Posted: Mon May 16, 2016 10:03 am
by trmpluym
I frequently use the incremental search functionality in my programs based on the sample:

..\SAMPLES\Controls\Grid\GridIncrementalSearch

Now each time i use this functionality i need to create a ON KEY procedure ( like the Proc_GridSearchString() in the sample).

But most of the time the ON KEY procedures are more or less the same. Only the From name and the Grid name changes ( in the example Form_1 and Grid_1 ).

So i tried to change the ON KEY procedure without specific grid and form names using the This and ThisWindow but without success.

For example change

Form_1.Grid_1.CellEx(k,COL_SEARCH)

in

This.CellEx(k,COL_SEARCH)

Or

Form_1.Label_PressedChar.Value := ch

in

ThisWindow.Label_PressedChar.Value := ch

This seems not the way to go, but is there another solution ?

Re: This ThisWindow Parent how to use in on key procedure in grid

Posted: Mon May 16, 2016 11:28 am
by mol
Use SetProperty function:

SetProperty(ThisWindow.Name, "Label_PressedChar","Value", ch)

Re: This ThisWindow Parent how to use in on key procedure in grid

Posted: Tue May 17, 2016 7:32 pm
by trmpluym
Thanks Marek !

I understand the example with the Label_PressedChar.Value line. But i am not shure with the Grid_1.CellEx(k,COL_SEARCH) because it has got two parameters (k and COL_SEARCH).

Is this the right syntax ?

setProperty(ThisWindow.Name,"Grid_1","CellEx",k,COL_SEARCH)

Theo

Re: This ThisWindow Parent how to use in on key procedure in grid

Posted: Tue May 17, 2016 10:41 pm
by trmpluym
Found the answer in the forum !

http://hmgforum.com/viewtopic.php?t=3521

Marek, thanks again !

Re: This ThisWindow Parent how to use in on key procedure in grid

Posted: Wed May 18, 2016 5:19 am
by mol
Great!