Page 1 of 1

WebGadget and HtmlCode

Posted: Mon Sep 27, 2010 1:47 pm
by lavachri
Hi,
I have un ListIcon and a WebGadget.
i need to set HtmlCode in the WebGadget, but it don't work fine...

First if i hit up/down key in the list, no problems.
but if i set focus on the WebGadget (with F6), and i comeBack to fhe List (with F5), i can't move in list with up/down...
it seems the focus automaticaly retrun to the WebGadget.

Code: Select all

  If OpenWindow(0,0,0,600,500,"WebGadget",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) 
    ListIconGadget(0,10,10,580,180,"Name",580)
    WebGadget(1,10,200,580,280,"")
    For I = 0 To 10
      AddGadgetItem( 0, -1, "Line " + Str(I) )
    Next I
    AddKeyboardShortcut( 0, #PB_Shortcut_F5, 0 )
    AddKeyboardShortcut( 0, #PB_Shortcut_F6, 1 )
    SetActiveGadget( 0 )
    Repeat 
      Ev = WaitWindowEvent()  
      Select EV
      Case #PB_Event_Menu
        SetActiveGadget( EventMenu() )
      Case #PB_Event_Gadget
        If EventGadget() = 0
          SetGadgetItemText( 1, #PB_Web_HtmlCode, "<html><body>"+GetGadgetText( 0 ) + "</body></html>" )
        EndIf
      EndSelect
    Until Ev = #PB_Event_CloseWindow
  EndIf
Thanks

Re: WebGadget and HtmlCode

Posted: Mon Sep 27, 2010 2:37 pm
by srod
A combination of DisableGadget()s and a WindowEvent() loop seems to fix it here :

Code: Select all

  If OpenWindow(0,0,0,600,500,"WebGadget",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) 
    ListIconGadget(0,10,10,580,180,"Name",580)
    WebGadget(1,10,200,580,280,"")
    For I = 0 To 10
      AddGadgetItem( 0, -1, "Line " + Str(I) )
    Next I
    AddKeyboardShortcut( 0, #PB_Shortcut_F5, 0 )
    AddKeyboardShortcut( 0, #PB_Shortcut_F6, 1 )
    SetActiveGadget( 0 )
    Repeat 
      Ev = WaitWindowEvent()  
      Select EV
      Case #PB_Event_Menu
        SetActiveGadget( EventMenu() )
      Case #PB_Event_Gadget
        If EventGadget() = 0
          DisableGadget(1, 1)
          SetGadgetItemText( 1, #PB_Web_HtmlCode, "<html><body>"+GetGadgetText( 0 ) + "</body></html>" )
          While WindowEvent() : Delay(1) : Wend
          DisableGadget(1, 0)
        EndIf
      EndSelect
    Until Ev = #PB_Event_CloseWindow
  EndIf
A curious one for sure. Afraid that you do have to put up with some peculiarities with the web-gadget, being based upon the IE ActiveX control as it is (Windows).

Re: WebGadget and HtmlCode

Posted: Mon Sep 27, 2010 2:53 pm
by lavachri
Thanks,
it's good !