Simplicty and flexibility!


GetCurrent() getting first, not current objectname


Started by Paul Cheeseman
Search
You will need to Sign In to be able to add or comment on the forum!

GetCurrent() getting first, not current objectname

When using getcurrent() to get an object name, in my case the name of a button and triggering it from MouseEnter, it actually returns the name of the first object on the form, instead of the actual button I am mousing over.

so instead of getcurrent("Objectname") returning "AdvertEnterButton" which is the third button object name, it returns "ExitButton" which is the first object.

If I then move that first object, it returns the name of the 'next' first object which happens to be an image

It returns the first object name whichever button or field that I put the code on. I have tried this on a few forms with the same results.

Simple testcode is       x:=alert(GetCurrent("ObjectName")) .


Written by Paul Cheeseman 27/04/23 at 15:10:02 Not product specific.

Re:GetCurrent() getting first, not current objectname

I know this is something to do with focus 


Written by Paul Cheeseman 27/04/23 at 15:40:46 Not product specific.

Re:Re:GetCurrent() getting first, not current objectname



This is GetCurrent("ObjectName") used correctly with the correct context.


The big news in DE6 was "OML" i.e. a event language that one could use to control ones forms etc.
Sadly it was never very well implemented and riddled with bugs, inconsistencies, omissions, a bad editor and a lot of promise and not so much delivery. Last but not least it could corrupt your document beyond recovery.

All in all it was either loved or hated and the majority of DE users feared it.

In 8 we decided that we would  make functions that would cover the most of the functionality that people needed to use OML for so they could develop applications without using OML or at least as little as possible.

Obviously the only thing that you can't do with actions/derivations/execdql's etc is the even bit where OML is the right tool.

We have now mostly got it to work consistently so there is no good reason for not using it anymore but it is a different world to the linear DE thinking and functions and GUI functions and OML is not good friends so when in OML try to use the OML way and if you want to use GUI functions use them in virtual fields, on buttons, in ExecDQL etc.

You need to be in OML to catch the OML events as the GUI functions live in another universe so to try to use GetCurrent("ObjectName") will not have the context of the OML object as it will be in a different state so will report the first object.

But to get the name of the current object in OML is easy.

message name .


Written by DataEase 27/04/23 at 17:26:04 Not product specific.
DG3_ForumList