Page 1 of 1

Focus "into" ActiveX Control

Posted: Sat Dec 14, 2019 6:41 am
by AUGE_OHR
hi,

i have put a ActiveX into a FMG.
it does load file and show it

Code: Select all

   ShowHtml.Activex_1.Object:Navigate(cFile)
   ShowHtml.Activex_1.SetFocus
   Activate Window ShowHtml
now the Focus is not "inside" ActiveX so i must click into it to scroll it
i have try

Code: Select all

   ShowHtml.Activex_1.Object.SetFocus
   ShowHtml.Activex_1.Object:SetFocus
but this Syntax was wrong. :(
who can help me please with Syntax.

Re: Focus "into" ActiveX Control

Posted: Sat Dec 14, 2019 10:35 am
by SALINETAS24
Hola Auge, no he utilizado ese tipo de control, pero prueba con
DoMethod( cWind, cCtrol, 'SetFocus' )
y también tienes
SetProperty("ShowHtml","Activex_1","setFocus",.t.)

Suerte...!!

Re: Focus "into" ActiveX Control

Posted: Sat Dec 14, 2019 2:12 pm
by andyglezl
Parece que ese control no tiene ese método o propiedad...
*------------------------------------------------------------------------
It seems that control does not have that method or property ...

hmgdoc/data/index.htm



Revisando en mi código, yo lo maneje hace algún tiempo así
(dentro de una ventana PANEL)
*-------------------------------------------------------------------------
Checking in my code, I handled it some time ago like this
(inside a PANEL window)

Code: Select all

	DEFINE WINDOW cWinPso ROW 030 COL 000 WIDTH nWinWidth HEIGHT nWinHeight-45 PANEL BACKCOLOR GRAY
		_DefineActivex('PagWeb', cWinPso, 000, 000, 1024, nWinHeight-45, "shell.explorer" )
		oPagina := GetProperty( cWinPso, 'PagWeb', 'Object')
		oPagina:Navigate( "http://www.net2ftp.com/index.php" )
		DOMETHOD( cWinPso, "SetFocus")
		_PushKey( VK_DOWN )
	END WINDOW	

Re: Focus "into" ActiveX Control

Posted: Mon Dec 16, 2019 5:18 pm
by luisvasquezcl
Try with:
ShowHtml.Activex_1.Object:document.getElementById("my_control").focus()

Re: Focus "into" ActiveX Control

Posted: Mon Dec 16, 2019 6:26 pm
by AUGE_OHR
luisvasquezcl wrote: Mon Dec 16, 2019 5:18 pm Try with:
ShowHtml.Activex_1.Object:document.getElementById("my_control").focus()
thx for Tip but
C:\hmg.3.4.4\0\MAIL\email.prg(1628) Error E0030 Syntax error "syntax error at '.'"
but is is the same Idea as i had but i fail too

Code: Select all

PROCEDURE DoPreShow()
      hWnd := GetControlHandle( 'Activex_1', "ShowHtml" )
      FindDocObject(hWnd)
RETURN

FUNCTION FindDocObject(hWnd)
LOCAL nRet := 0
ALTD()
   nRet := FindWindowEx(hWnd,0,"Internet Explorer_Server",0)
   IF nRet > 0
      Set_Focus(nRet)
   ELSE
      nRet := FindWindowEx(hWnd,0,"Shell DocObject View",0)
      IF nRet > 0
         Set_Focus(nRet)
      ELSE
         nRet := FindWindowEx(hWnd,0,0,"Shell DocObject View")
         IF nRet > 0
            Set_Focus(nRet)
         ELSE
            nRet := FindWindowEx(hWnd,0,0,"Internet Explorer_Server")
            IF nRet > 0
               Set_Focus(nRet)
            ENDIF
         ENDIF
      ENDIF
   ENDIF

RETURN nRet
none of them find "Child" in Form ... :cry:

Re: Focus "into" ActiveX Control

Posted: Mon Dec 16, 2019 6:40 pm
by AUGE_OHR
hi

have try more and found "." Problem

Code: Select all

ShowHtml.Activex_1.Object:document:getElementById(
but than i got the Error
NoFocus.jpg
NoFocus.jpg (53.33 KiB) Viewed 2318 times
i will try more ... but i guess it simple does not work with HMG

ActiveX of HMG seems limited to CreateObject() so you can Call it but not react on Event :cry:

Re: Focus "into" ActiveX Control

Posted: Mon Dec 16, 2019 10:53 pm
by AUGE_OHR
i still try to set Focus into AX Control.

now i saw in Debugger :shock:
AX_HWND.png
AX_HWND.png (106.26 KiB) Viewed 2298 times
i got Hwnd this Way

Code: Select all

   hWnd := GetControlHandle( 'Activex_1', "ShowHtml" )
so what can make the Difference :?:

p.s. the App i use is WinID https://www.dennisbabkin.com/winid/