In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

IDEEditor - how to focus?

Xailer professional forum in English
Responder
Avatar de Usuario
Hurricane
Mensajes: 262
Registrado: Mar Mar 24, 2015 10:21 am
Ubicación: Brasil
Contactar:

IDEEditor - how to focus?

Mensaje por Hurricane »

Hi,

after opening a file in the editor, how to give focus to the editor?
I found the method in the documentation, but it didn't work.

Código: Seleccionar todo

METHOD BtnOkClick( oSender ) CLASS TFrmVPF
   ....
   ::Close()
   ::oPlugin:IEditor:SetFocused() // does not work
   RETURN Nil
If I have a Form open in Designer, I press CTRL+F12 to show my "View Forms Project" window to select a file, it is opened in Editor, but Form Designer remains in front.
in the image, the file is active, but the editor is not in focus.
If you open a file via Project Manager, the Editor is in focus.
IDEEDITOR_FOCUS.png
IDEEDITOR_FOCUS.png (33.68 KiB) Visto 756 veces
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: IDEEditor - how to focus?

Mensaje por ignacio »

Código: Seleccionar todo

#define SCI_GRABFOCUS         2400
..      
 WITH OBJECT oCode:oCodeEditor1
   :PostMsg( WM_SETFOCUS, 0, 0 )
   :PostMsg( SCI_GRABFOCUS, 0, 0 )
END WITH
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Avatar de Usuario
Hurricane
Mensajes: 262
Registrado: Mar Mar 24, 2015 10:21 am
Ubicación: Brasil
Contactar:

Re: IDEEditor - how to focus?

Mensaje por Hurricane »

Please, what is the complete information?
where do I find the TCODE instance? (when the editor is not in focus)

msgInfo(::IProjectMan:oActiveForm:classname) // TCode (I found :oCodeEditor1) - When Editor is in focus
msgInfo(::IProjectMan:oActiveForm:classname) // TFormEditor - When FormDesigner is in focus

it worked, but it's ugly:

Código: Seleccionar todo

   // ::IEditor:SetFocused() // not work, Topic: https://forum.xailer.com/viewtopic.php?p=55666#p55666
   IF (nPos:=AScan( Application:aForms, {|o| Upper(o:CLASSNAME) == 'TCODE' } )) > 0
      WITH OBJECT Application:aForms[nPos]
        :PostMsg( WM_SETFOCUS, 0, 0 )
        :PostMsg( SCI_GRABFOCUS, 0, 0 )

      END WITH
   ENDIF
ignacio escribió: Mié Nov 10, 2021 1:06 pm

Código: Seleccionar todo

#define SCI_GRABFOCUS         2400
..      
 WITH OBJECT oCode:oCodeEditor1
   :PostMsg( WM_SETFOCUS, 0, 0 )
   :PostMsg( SCI_GRABFOCUS, 0, 0 )
END WITH
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5706
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

Re: IDEEditor - how to focus?

Mensaje por jfgimenez »

Hi,

try:

Código: Seleccionar todo

::oPlugin:GetProjectMan():ToggleForm()
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Avatar de Usuario
Hurricane
Mensajes: 262
Registrado: Mar Mar 24, 2015 10:21 am
Ubicación: Brasil
Contactar:

Re: IDEEditor - how to focus?

Mensaje por Hurricane »

Hello,

it doesn't work either (and it gets worse, it will affect the Designer).
I have emailed a small complete example.

thanks,
jfgimenez escribió: Mié Nov 10, 2021 7:59 pm

Código: Seleccionar todo

::oPlugin:GetProjectMan():ToggleForm()
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: IDEEditor - how to focus?

Mensaje por ignacio »

Código: Seleccionar todo

#define SCI_GRABFOCUS         2400
..      
   handle :=  ::GetEditor():Handle
   PostMessage( handle, WM_SETFOCUS, 0, 0 )
   PostMessage( handle, SCI_GRABFOCUS, 0, 0 )
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Avatar de Usuario
Hurricane
Mensajes: 262
Registrado: Mar Mar 24, 2015 10:21 am
Ubicación: Brasil
Contactar:

Re: IDEEditor - how to focus?

Mensaje por Hurricane »

worked, thanks.
ignacio escribió: Jue Nov 11, 2021 10:19 am

Código: Seleccionar todo

#define SCI_GRABFOCUS         2400
..      
   handle :=  ::GetEditor():Handle
   PostMessage( handle, WM_SETFOCUS, 0, 0 )
   PostMessage( handle, SCI_GRABFOCUS, 0, 0 )
Responder