Page 1 of 2

Posted: Wed Feb 19, 2003 6:17 am
by BackupUser
Restored from previous forum. Originally posted by Jose.

Hi, When using the WebGadget to display a web page that has input fields the TAB and SHIFT TAB keys do not apply inside the web page, any one know how I can fix this problem.

Here is some sample code;

nW.l=470 : nH.l=232
nX.l=(GetSystemMetrics_(#SM_CXSCREEN)-nW)/2
nY.l=(GetSystemMetrics_(#SM_CYSCREEN)-nH)/2

If OpenWindow(0,nX,nY,nW,nH,#PB_Window_MinimizeGadget, "test")
If CreateGadgetList(WindowID())
WebGadget(0, 1, 1, nW-1, nH-1, "C:\test.html")
EndIf
EndIf

bQuit.l = #FALSE
Repeat
If WaitWindowEvent() = #PB_EventCloseWindow
bQuit = #TRUE
EndIf
Until bQuit

here is the test HTML page


Name



Address







To see the problem, run this code, click in one field then press TAB key and see what happens, in W2K nothing happens.
Thanks
Jose

Registered PureBasic User

Posted: Wed Feb 19, 2003 3:27 pm
by BackupUser
Restored from previous forum. Originally posted by ricardo.

Hi,

Yes, you are right.
I run your html code, first in IE and the tabs where working ok, then run the webgadget and dosent receive tabs.

I dont know why Fred decide to ignore a lot of webgadget stuff. The object that he is using has a lot more functionality that is absolutely neccesary if somebody is planning to develop a serious application using the webgadget, i hope that i next versin this will change.



Best Regards

Ricardo

Dont cry for me Argentina...

Posted: Wed Feb 19, 2003 4:12 pm
by BackupUser
Restored from previous forum. Originally posted by pusztry.

@Ricardo
I agree Fred REALY needs to add to the web gadget. I can't realy do anything with it exception view basic pages. I realy wanted to develope with the web gadget but is just isn't functional enough.
That is just my $.02

- Ryan
RJP Computing

WinXP, PIII 800 MHz, 512MB RAM, SB Live 5.1, NVidia TNT 2 Ultra

Posted: Thu Feb 20, 2003 8:54 am
by BackupUser
Restored from previous forum. Originally posted by fred.

I will take a look


Fred - AlphaSND

Posted: Sat May 15, 2004 4:54 pm
by Aeroschmelz
The problem still exists, right ? Is there a solution for tab+enter+etc to use like in Internet Explorer

Posted: Sun May 16, 2004 5:09 am
by PolyVector
I've tried just about everything I can think of... can't get it to work either :(

Posted: Mon May 17, 2004 12:06 am
by Sparkie

Posted: Tue May 18, 2004 6:15 pm
by Jose
@Sparkie
Thanks for the pointer, do know how to do what the doc says in PB?

Would be cool to solve this problem and post it in tricks :lol:

Posted: Tue May 18, 2004 6:29 pm
by Sparkie
Sorry Jose, but converting the doc to PB code is over my head. I did make some progress, but not enough to post any results. Surely one of our resident PB experts can figure this one out ;)

Until then, I will keep trying :)

Posted: Fri May 28, 2004 2:51 pm
by Sparkie
Sometimes it's better to be lucky than good. :wink:

After many hours of unsuccessful attempts to trap the TAB (and DELETE) keys in a WebGadget, I think I stumbled upon success. 8O

**** Edited to fix bug and to update to PB 4.xx

Code: Select all

If OpenWindow(0, 0, 0, 700, 500, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_TitleBar) And CreateGadgetList(WindowID(0)) 
  hWeb = WebGadget(1, 10, 10, 680, 480, "http://www.google.com/") 
  WebObject.IWebBrowser2 = GetWindowLong_(GadgetID(1), #GWL_USERDATA) 
  CoInitialize_(0) 
  CoCreateInstance_(?CLSID_IOleInPlaceActiveObject, 0, 1, ?IID_IOleInPlaceActiveObject,@OleObject.IOleInPlaceActiveObject) 
  Repeat 
    event = WaitWindowEvent() 
    If EventGadget() = 1 And event = #WM_KEYDOWN
      If EventwParam() = #VK_TAB Or EventwParam() = #VK_DELETE
        WebObject\QueryInterface(?IID_IOleInPlaceActiveObject, @OleObject) 
        web.MSG\message = event 
        ;... I know EventwParam() and EventwLaram()are no longer 
        ;... supported in Purebasic, but for now it works 
        web\wParam = EventwParam() 
        web\lParam = EventlParam() 
        OleObject\TranslateAccelerator(@web) 
        OleObject\Release() 
      EndIf
    EndIf 
  Until event = #PB_Event_CloseWindow 
  CoUninitialize_() 
EndIf 
End 

DataSection 
;{00000117-0000-0000-C000-000000000046} 
IID_IOleInPlaceActiveObject: 
Data.l $00000117 
Data.w $0000, $0000 
Data.b $C0, $00, $00, $00, $00, $00, $00, $46 

;{00000320-0000-0000-C000-000000000046} 
CLSID_IOleInPlaceActiveObject: 
Data.l $00000320 
Data.w $0000, $0000 
Data.b $C0, $00, $00, $00, $00, $00, $00, $46 
EndDataSection
Hopefully, someone who's more versed in this area can clean this up for us.

Posted: Sat May 29, 2004 3:11 am
by PolyVector
NICE :)
been tryin' to solve this for a long time :)

Posted: Sat May 29, 2004 8:08 am
by Edwin Knoppert
If the wc is created via ATL.. a simple extra forwardmessages (sendmessage()) is required in the messagepump.

Posted: Sat May 29, 2004 8:48 am
by PolyVector
@Edwin
I've tried passing the messages along in the messagepump with no success... do you have a working example of this?

Posted: Sat May 29, 2004 2:03 pm
by Edwin Knoppert
Unf. this is part of my visual designer:
You'll get the idea though, FOR ATL ONLY!

Code: Select all

        While GetMessage( Msg, 0, 0, 0 )

            hWndFocus = 0
            nNot = 0

#If %Def( %MOD_VD_ATL )
            Select Case Msg.message
            Case %WM_KEYFIRST, %WM_KEYLAST, %WM_MOUSEFIRST, %WM_MOUSELAST
                hWndFocus = GetFocus()
                Do While hWndFocus
                    If LCase$( VD_GetClassName( hWndFocus, 0 ) ) <> "atlaxwin" Then
                        hWndFocus = GetParent( hWndFocus )
                        Iterate
                    End If
                    '%WM_FORWARDMSG
                    nNot = SendMessage( hWndFocus, &H37F, 0, ByVal VarPtr( Msg ) )
                    Exit Do
                Loop
            End Select
#EndIf
            If nNot Then Iterate

''''''''''''''''''' etc..


Posted: Wed Nov 28, 2007 10:58 am
by thyphoon
I have a little problem with Sparkie's code.The TAB works fine but when i use the delete key in a form 2 characters are deleted not juste one !

What can i do to resolve this problem ?
Thanks, and excuse me for my bad english !

Code PB4.10

Code: Select all

myurl$ = "http://www.google.com/advanced_group_search?hl=en"

If OpenWindow(0, 0, 0, 700, 500,"Web Accelerator Keys", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_TitleBar)
  If CreateGadgetList(WindowID(0))
    hWeb = WebGadget(0, 10, 10, 680, 480, myurl$)
    WebObject.IWebBrowser2 = GetWindowLong_(GadgetID(0), #GWL_USERDATA)
  EndIf
EndIf

CoInitialize_(0)
If CoCreateInstance_(?CLSID_IOleInPlaceActiveObject,0,1,?IID_IOleInPlaceActiveObject,@OleObject.IOleInPlaceActiveObject) = 0
EndIf
CoUninitialize_()
web.MSG

Repeat
 
  Event = WaitWindowEvent()
  If Event = #WM_KEYDOWN
    WebObject\QueryInterface(?IID_IOleInPlaceActiveObject, @OleObject)
    web\message = Event
    web\wParam = EventwParam()
    web\lParam = EventlParam()
    OleObject\TranslateAccelerator(@web)
    OleObject\Release()
  EndIf
 
Until Event = #PB_Event_CloseWindow
End

DataSection
;{00000117-0000-0000-C000-000000000046}
IID_IOleInPlaceActiveObject:
Data.l $00000117
Data.w $0000, $0000
Data.b $C0, $00, $00, $00, $00, $00, $00, $46

;{00000320-0000-0000-C000-000000000046}
CLSID_IOleInPlaceActiveObject:
Data.l $00000320
Data.w $0000, $0000
Data.b $C0, $00, $00, $00, $00, $00, $00, $46
EndDataSection