[PB6.10B9] Problem #PB_Web_SelectedText and #PB_Web_Edge

Post bugreports for the Windows version here
IB-Software
User
User
Posts: 18
Joined: Sat Jun 21, 2003 12:11 pm

[PB6.10B9] Problem #PB_Web_SelectedText and #PB_Web_Edge

Post by IB-Software »

I want to select and read text in a web gadget using the following code:

Code: Select all

Procedure Event_Browser()
  Select EventType()
    Case #PB_EventType_PopupMenu
      Debug GetGadgetItemText(0, #PB_Web_PageTitle     )
      Debug GetGadgetItemText(0, #PB_Web_SelectedText     )
  EndSelect
EndProcedure

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    WebGadget(0, 10, 10, 580, 280, "https://www.purebasic.com",#PB_Web_Edge)
    SetGadgetAttribute(0, #PB_Web_BlockPopupMenu, #True)
    BindGadgetEvent(0,@Event_Browser()) 
    
    Repeat 
    Until WaitWindowEvent() = #PB_Event_CloseWindow
    
EndIf

If the Webgadget with the "#PB_Web_Edge" flag is used and the selection has been read out, the window is in an infinite loop and no longer responds to any input and can no longer be closed.

Without "#PB_Web_Edge" the window and the Webgadget react normally.
But with "#PB_Web_Edge" and without GetGadgetItemText(0, #PB_Web_SelectedText) no error occurs.
It appears that WaitWindowEvent() is no longer evaluated.


Ingo

Sorry for my English. My language is German.
(Translated with http://www.DeepL.com/Translator)
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: [PB6.10B9] Problem #PB_Web_SelectedText and #PB_Web_Edge

Post by breeze4me »

An IMA error occurs with 6.10 b9 x86.

Code: Select all

Procedure Event_Browser()
  Select EventType()
    Case #PB_EventType_PopupMenu
      Debug GetGadgetItemText(0, #PB_Web_PageTitle     )
      Debug GetGadgetItemText(0, #PB_Web_SelectedText     )
  EndSelect
EndProcedure

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    WebGadget(0, 10, 10, 580, 280, "https://www.purebasic.com",#PB_Web_Edge)
    
    ;Invalid memory access. (read error at address 138775296)
    SetGadgetAttribute(0, #PB_Web_BlockPopupMenu, #True)
    
    
    BindGadgetEvent(0,@Event_Browser()) 
    
    Repeat 
    Until WaitWindowEvent() = #PB_Event_CloseWindow
    
EndIf
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [PB6.10B9] Problem #PB_Web_SelectedText and #PB_Web_Edge

Post by Fred »

This command uses a event waiting loop to be sync so it can't be used in a binded callback unfortunately. I will add a debugger check to detect this easily.
IB-Software
User
User
Posts: 18
Joined: Sat Jun 21, 2003 12:11 pm

Re: [PB6.10B9] Problem #PB_Web_SelectedText and #PB_Web_Edge

Post by IB-Software »

Thank you for the explanation.


Ingo
Post Reply