Page 1 of 1

Posted: Mon Dec 30, 2002 11:40 am
by BackupUser
Restored from previous forum. Originally posted by Max..

-
Update:
Changed topic so it's more descriptive.
At the moment I'm messing with MultiLine StringGadgets, trying to catch the Return. Wish me luck. :wink:
-

I'm trying to "fake" an editeable ListIconGadget at the moment. You click on the Item in the Gadget, a StringGadget appears and the entered text should be used to update the column.

I'm facing the problem now that I cannot get an event, when the Enter-Key is pressed in the StringGadget.

I tried this:

Code: Select all

Select EventGadgetID()
Case #NoteInput
  Select EventwParam()
   Case 13
     CallDebugger
  EndSelect
EndSelect
both in the main loop as in the callback (as can be seen in the example below).

Help... :cry:

Code: Select all

#Window1 = 0
#Window2 = 1
#W2LstIcon1 = 0
#NoteInput=1

#Window1Flags = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget
#Window2Flags = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
#W2LstIcon1Flags = #PB_ListIcon_CheckBoxes | #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #PB_ListIcon_HeaderDragDrop


Procedure ShowWindow2()
  If OpenWindow( #Window2, 0,0,390,313, #Window2Flags,"Window 2")
    If CreateGadgetList(WindowID(#Window2))
      ListIconGadget (#W2LstIcon1,10,7 ,WindowWidth()-20,WindowHeight()-29,"",20,#W2LstIcon1Flags)
      AddGadgetColumn(#W2LstIcon1, 1, "X", 30)
      AddGadgetColumn(#W2LstIcon1, 2, "Y", 30)
      AddGadgetColumn(#W2LstIcon1, 3, "Notiz", 300)
    EndIf
  EndIf
EndProcedure

Procedure myCallback(WindowID, Message, wParam, lParam)
  
  Result = #PB_ProcessPureBasicEvents
  
  
  Select Message
    
  Case #WM_LBUTTONDOWN
    
    AddGadgetItem(#W2LstIcon1,-1,""+Chr(10)+Str(WindowMouseX())+Chr(10)+Str(WindowMouseY()))
    
  Case #WM_CHAR
    Select EventGadgetID()
    Case #NoteInput
      Select EventwParam()
      Case 13
        CallDebugger
      EndSelect
    EndSelect
    
    
    Default
  EndSelect
  
  ProcedureReturn Result
EndProcedure


If OpenWindow(#Window1, 100, 100, 400,400,#Window1Flags ,"Window1")
  ShowWindow2()
  UseWindow(#Window1)
  SetWindowCallback(@myCallback())
  Repeat
    EventID.l = WaitWindowEvent()
    If EventID = #PB_EventGadget
      Select EventGadgetID()
      Case #W2LstIcon1
        Select EventType()
        Case #PB_EventType_LeftClick
          DisableGadget(#W2LstIcon1,1)
          UseGadgetList(WindowID(#Window2))
          StringGadget(#NoteInput,250,200,100,20,"")
        EndSelect
      Case #NoteInput
        
      EndSelect
    EndIf
    
  Until EventID = #PB_EventCloseWindow
  
EndIf

Posted: Mon Dec 30, 2002 2:02 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.

I would either use AddKeyboardShortcut() with #PB_Key_Return (if that's the constant's name) or use GetWindowLong_(WindowID, GWL_ID) instead of EventGadgetID() in the callback. Also wParam instead of EventwParam(), because I think the callback is processed before WaitWindowEvent() and so the data for EventGadgetID() and EventwParam() is not correct at that moment.

El_Choni

Posted: Mon Dec 30, 2002 4:10 pm
by BackupUser
Restored from previous forum. Originally posted by Max..

Thanks.

How I do now - and how it works - is the mentioned MultiLine StringGadget, parsing for CR and then stripping the unwanted stuff.

I will try your suggestions; hopefully that is it. :)

Posted: Mon Dec 30, 2002 6:13 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.

Hi Max,
if you need more help on this, or a different approach look @:
http://fsw.home.attbi.com/puregui.html

There I use a different way on handling events on StringGadgets.
It works also if you have different StrinGadgets on different Windows.
Look @ the CheckEnterKey Procedure. My Event-Handler uses it only on StringGadgets.
Maybe it heps.


Have a nice day...

Franco

Posted: Mon Dec 30, 2002 6:31 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> I cannot get an event, when the Enter-Key is pressed in the StringGadget.

I just updated one of my old tips, so see if this helps you at all:

http://www.curvesoftware.co.uk/purebasi ... IC_ID=1108