[PB 4.1 B4] Textgadget & Events (solved, no pb-bug)

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kiffi
Addict
Addict
Posts: 1504
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

[PB 4.1 B4] Textgadget & Events (solved, no pb-bug)

Post by Kiffi »

Hello,

after a doubleclick with the left mousebutton on the textgadget the
following code shows #PB_EventType_LeftClick and
#PB_EventType_RightClick instead of #PB_EventType_LeftDoubleClick.

Why?

TIA & Greetings ... Kiffi

Code: Select all

OpenWindow(0, #PB_Ignore, #PB_Ignore, 200, 30, "")
CreateGadgetList(WindowID(0))
TextGadget(1, 5, 5, 190, 20, "Click here!", #PB_Text_Border | #SS_NOTIFY)

Repeat
  
  WWE = WaitWindowEvent()
  
  If WWE=#PB_Event_Gadget And EventGadget()=1

    Select EventType()
      Case #PB_EventType_LeftClick        : Debug "#PB_EventType_LeftClick"
      Case #PB_EventType_RightClick       : Debug "#PB_EventType_RightClick"
      Case #PB_EventType_LeftDoubleClick  : Debug "#PB_EventType_LeftDoubleClick"
      Case #PB_EventType_RightDoubleClick : Debug "#PB_EventType_RightDoubleClick"
      Case #PB_EventType_Focus            : Debug "#PB_EventType_Focus"
      Case #PB_EventType_LostFocus        : Debug "#PB_EventType_LostFocus"
      Case #PB_EventType_Change           : Debug "#PB_EventType_Change"
      Case #PB_EventType_DragStart        : Debug "#PB_EventType_DragStart"
    EndSelect
    
  EndIf
  
  
Until WWE=#PB_Event_CloseWindow
Last edited by Kiffi on Wed Nov 07, 2007 8:26 pm, edited 1 time in total.
Hygge
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Iirc, #PB_EventType_LeftDoubleClick never worked with static controls (even with #SS_NOTIFY style).
It works with subclassing though.

Code: Select all

Procedure StaticCallback(hwnd, uMsg, wParam, lParam) 
  Protected Result.l
  Shared OldProc
  Result = CallWindowProc_(OldProc, hwnd, uMsg, wParam, lParam) 
  ;
  If uMsg = #WM_LBUTTONDBLCLK
    Debug "Double-click"
  EndIf
  ;
  ProcedureReturn Result
EndProcedure 


OpenWindow(0, #PB_Ignore, #PB_Ignore, 200, 30, "") 
CreateGadgetList(WindowID(0)) 
TextGadget(1, 5, 5, 190, 20, "Click here!", #PB_Text_Border | #SS_NOTIFY) 
OldProc = SetWindowLong_(GadgetID(1), #GWL_WNDPROC, @StaticCallback())  

Repeat 
  WWE = WaitWindowEvent() 
Until WWE=#PB_Event_CloseWindow
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
freak
PureBasic Team
PureBasic Team
Posts: 5944
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

#SS_NOTIFY is not a PB flag...
quidquid Latine dictum sit altum videtur
Fred
Administrator
Administrator
Posts: 18252
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

A TextGadget() doesn't support any event officially.
User avatar
Kiffi
Addict
Addict
Posts: 1504
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Post by Kiffi »

@Fred & freak: Thanks for your info! I changed the subject of this thread.

@gnozal: Thanks for your solution!

Greetings ... Kiffi
Hygge
Post Reply