cancel
Showing results for 
Search instead for 
Did you mean: 

SAPGui Scripting SystemFocus or GUIFocus.

Former Member
0 Kudos

I can not seem to get the syntax correct for either of these commands.

I have a script and I am trying to determine the inout field where the cursor is placed.

my code looks something like this now, but it is obviously not correct:

msg = session.findbyid("wnd[0]").systemfocus

I am not trying to SET the focus, only determine where the field name where the cursor resides.

Thank you,

Mike

Accepted Solutions (0)

Answers (1)

Answers (1)

stefan_schnell
Active Contributor
0 Kudos

Hello Mike,

try this:

Set Focus = session.ActiveWindow().GUIFocus()
MsgBox Focus.Name & vbCrLf & Focus.Id & vbCrLF & Focus.Type

I hope you get the information you need.

Cheers

Stefan

0 Kudos

Hello Stefan,

It is possible to know from the various components where is the focus?

The result is shown in the user area, there are several GuiCheckBox I have to select what is to focus, but for that I have to get your ID.

Scripting Tracker - Analyser:

Object type: GuiCheckBox (42)

ID: /app/con[0]/ses[0]/wnd[0]/usr/chk[1,7]

Thank you very much.

Cheers.

Márcio.

stefan_schnell
Active Contributor
0 Kudos

Hello Marcio,

you can find a solution here.

Cheers

Stefan

0 Kudos
Hello Stefan,

The result obtained was the same:

Set Focus session.ActiveWindow = (). GUIFocus ()
MsgBox Focus.Name & vbCrLf & vbCrLf & Focus.Id & Focus.Type

Result =
Focus Name = usr
Focus ID = /app/con[0]/ses[0]/wnd[0]/usr
Focus Type = GuiUserArea

ActID = session.ActiveWindow.GuiFocus.ID
MsgBox ActID

Result =
GuiFocus.ID = /app/con[0]/ses[0]/wnd[0]/usr

I need to know ID GuiCheckBox that is currently in focus within the GuiUserArea.

Thank you so much.

Márcio.


stefan_schnell
Active Contributor
0 Kudos

Hello Márcio,

you are right, it is the same. Mmm, sorry but I don't know a property or method to get the ID of the object which has the focus.

Cheers

Stefan