xsharp.eu • How to solve class related code issues possible in VO but not in .Net? - Page 3
Page 3 of 4

How to solve class related code issues possible in VO but not in .Net?

Posted: Tue Apr 06, 2021 5:59 pm
by HeikoP
Robert, Chris,

even if Chris way to solve it sounds easier and faster to me, Roberts way with subclassing and defining the type of class of the FormDialog in the subclass of the Datawindow seems more familiar and flexible.

But this is just my opinion. Both ways would fit my needs for now.

Heiko

How to solve class related code issues possible in VO but not in .Net?

Posted: Tue Apr 06, 2021 6:14 pm
by Chris
Maybe a hybrid solution can be used, to introduce a global that holds the default value for symFormDialog. This way this trick can be used even in existing code that does not use common window subclasses and without needing any additional code, other than defining the class and assigning this global to the name of that class.

How to solve class related code issues possible in VO but not in .Net?

Posted: Tue Apr 06, 2021 7:00 pm
by wriedmann
Hello Heiko,
the solution Robert has proposed was available also in later versions of VO, so you can apply that change also to your VO code. Unfortunately I cannot find any reference to it in the various 2.8 whatsnew documents, so maybe it was added somewhere in the 2.7 versions.
I suspect that it was Robert that has added it.
Wolfgang

How to solve class related code issues possible in VO but not in .Net?

Posted: Tue Apr 06, 2021 7:42 pm
by ic2
Hello Robert, Chris,

Sounds good.

I also have a library called AFHook27 included which uses this Dispatch. When I define a METHOD BeforeHook in a datawindow I can use code like this:

LOCAL lDone AS LOGIC
IF lCtrlPressed
IF wParam = 65
SELF:oDCLV1:SelectAllItems()
lDone := TRUE
ENDIF
ENDIF
RETURN lDone

This code sample ensures that Ctrl A selects all items n a ListView and I have other appliances of course, all to do with shortcut keys in controls, e.g. also there is an option to scroll through tabs of a tabwindow using a hotkey.

Could I do that easier in X#, without this library?

Dick

How to solve class related code issues possible in VO but not in .Net?

Posted: Wed Apr 07, 2021 7:12 am
by HeikoP
Wolfgang, Robert,

great! I didn´t knew that, that was easy to change.

Thank you!

Heiko

How to solve class related code issues possible in VO but not in .Net?

Posted: Wed Apr 07, 2021 7:34 am
by Chris
Hi Dick,
ic2 wrote:Hello Robert, Chris,

Sounds good.

I also have a library called AFHook27 included which uses this Dispatch. When I define a METHOD BeforeHook in a datawindow I can use code like this:

LOCAL lDone AS LOGIC
IF lCtrlPressed
IF wParam = 65
SELF:oDCLV1:SelectAllItems()
lDone := TRUE
ENDIF
ENDIF
RETURN lDone

This code sample ensures that Ctrl A selects all items n a ListView and I have other appliances of course, all to do with shortcut keys in controls, e.g. also there is an option to scroll through tabs of a tabwindow using a hotkey.

Could I do that easier in X#, without this library?

Dick
You can definitely do it by subclassing the control. Not sure how this library works to tell if there's an easier way to do it, can you post the complete source code?

How to solve class related code issues possible in VO but not in .Net?

Posted: Wed Apr 07, 2021 10:54 am
by ic2
Hello Chris,

The library AEFHook27 is written by Lutz.Eckert, who also wrote WildSeek and contains 55 entities so I don't think you want to see all code ;) .
I just wondered if assigning shortcut keys to control in X# could be achieved easier, without this DLL.

If not, I will, in later attempts, try to convert this library and see if it works as it does in VO. If not, I will ask later. What I will do is mail you the DLL, just in case you want to check it out.

Dick

How to solve class related code issues possible in VO but not in .Net?

Posted: Wed Apr 07, 2021 12:30 pm
by Chris
Hi Dick,

In order to see how this library achieves this and tell if there's an easier way to do it (apart from simply subclassing the control), we need to see at least all the relevant code. So yes, please send the library .aef (not the dll) to have a look. Although I suppose this is a free library and the author wouldn't mind if you just posted it here, for other peoples benefit as well. Or I might be wrong about this :)

Edit: Ah OK, I see you have already sent the aef!

How to solve class related code issues possible in VO but not in .Net?

Posted: Thu Apr 08, 2021 10:54 am
by Karl-Heinz
Hi Dick,

I don't remember the AFHook27, but are there hits if you search the sources for those words:

AfterDispatch
BeforeDispatch
RegisterHotKey
SetWindowsHook

As the name 'Hook' suggests, i´m pretty sure that at least SetWindowsHook or SetWindowsHookEx are found ;-)


regards
Karl-Heinz

How to solve class related code issues possible in VO but not in .Net?

Posted: Thu Apr 08, 2021 12:17 pm
by ic2
Hello Karl-Heinz,

Chris had a look at the library and although it is capable of quite some functions, in some cases it may not even be needed. For example, I subclassed the ListView and assigning a (select all) shortcut key in that case can also be done directly in the Dispatch of the window with that ListView on it.

My suggestion was that should I still need this library and it wouldn't work in some point in the future (that is: when I continue to convert VO->X# and probably with a later X# version) I can better report then what doesn't work than that Chris spends time on checking if the planned modifications would or would not work with a library that may not be used widely and/or can be omitted with a bit of work.

Dick