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

Moderator: Rathinagiri

Post Reply
trmpluym
Posts: 246
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 6 times
Been thanked: 22 times

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

Post by trmpluym » Mon May 16, 2016 10:03 am

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: 3227
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 224 times
Been thanked: 127 times
Contact:

Post by mol » Mon May 16, 2016 11:28 am

Use SetProperty function:

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

trmpluym
Posts: 246
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 6 times
Been thanked: 22 times

Post by trmpluym » Tue May 17, 2016 7:32 pm

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: 246
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 6 times
Been thanked: 22 times

Post by trmpluym » Tue May 17, 2016 10:41 pm

Found the answer in the forum !

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

Marek, thanks again !


Post Reply