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

Moderator: Rathinagiri

Post Reply
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

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

Post 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 ?
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

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

Post by mol »

Use SetProperty function:

SetProperty(ThisWindow.Name, "Label_PressedChar","Value", ch)
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

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

Post 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
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

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

Post by trmpluym »

Found the answer in the forum !

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

Marek, thanks again !
Post Reply