Callback-Problem mit Version 4.50

Anfängerfragen zum Programmieren mit PureBasic.
ThoPie
Beiträge: 130
Registriert: 19.05.2006 15:18
Kontaktdaten:

Callback-Problem mit Version 4.50

Beitrag von ThoPie »

Bis zur Version 4.41 hat folgendes Callback bei ComboBoxen für die Focuserkennung problemlos funktioniert

Code: Alles auswählen

Procedure Callback(hWnd,uMsg,wParam,lParam)
  Select uMsg
    Case #WM_COMMAND
      If (wParam>>16)=#CBN_SETFOCUS
        Shortcuts_Entfernen() 
      ElseIf (wParam>>16)=#CBN_KILLFOCUS  
        Shortcuts_Zuordnen()  
      EndIf
  EndSelect
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
Aufruf erfolgt mit

Code: Alles auswählen

SetWindowCallback(@Callback())
Bei Version 4.50 wird dieses scheinbar ignoriert.

Auch die ComboBox-Autovervollständigung aus der WinAPI-Library funktioniert bei mir nicht mehr.
Muss ich da was für die 4.50er-Version anpassen?
Vielen Dank.
Bild
Benutzeravatar
gnozal
Beiträge: 219
Registriert: 04.12.2004 13:01
Wohnort: Frankreich (67)
Kontaktdaten:

Re: Callback-Problem mit Version 4.50

Beitrag von gnozal »

In PB4.50, the Windows ComboBoxGadget is a now a ComboBoxEx control ; this may explain the issue : http://www.purebasic.fr/english/viewtop ... 12&t=41683
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
ThoPie
Beiträge: 130
Registriert: 19.05.2006 15:18
Kontaktdaten:

Re: Callback-Problem mit Version 4.50

Beitrag von ThoPie »

Hallo,
könnte mir bitte bitte jemand ein Codeschnipsel geben, wie ich bei der "neuen" ComboBox den Focuserhalt und den Focusverlust ermitteln kann.
Danke schon mal im voraus.
Bild
Benutzeravatar
gnozal
Beiträge: 219
Registriert: 04.12.2004 13:01
Wohnort: Frankreich (67)
Kontaktdaten:

Re: Callback-Problem mit Version 4.50

Beitrag von gnozal »

Something like this should work :

Code: Alles auswählen

Procedure ComboProc(hWnd,uMsg,wParam,lParam)
  Shared *OldWndProc
  Select uMsg
    Case #WM_COMMAND
      If (wParam>>16)=#CBN_SETFOCUS
        Debug "Shortcuts_Entfernen() "
      ElseIf (wParam>>16)=#CBN_KILLFOCUS  
        Debug "Shortcuts_Zuordnen()  "
      EndIf
  EndSelect
  ProcedureReturn CallWindowProc_(*OldWndProc, hWnd, uMsg, wParam, lParam)
EndProcedure

OpenWindow(0, 100, 100, 300, 200, "Combo Test")
hWnd = ComboBoxGadget(0, 50, 50, 200, 20)
ButtonGadget(1, 10, 10, 50, 20, "Button")

*OldWndProc = SetWindowLongPtr_(hWnd, #GWL_WNDPROC, @ComboProc())
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
ThoPie
Beiträge: 130
Registriert: 19.05.2006 15:18
Kontaktdaten:

Re: Callback-Problem mit Version 4.50

Beitrag von ThoPie »

Danke, das funktioniert. Ich habe aber nun ein weiteres Problem. Für die ComboBoxen habe ich noch eine AutoComplete-Funktion eingebaut:

Code: Alles auswählen

hWnd = ComboBoxGadget(0, 10, 10, 250, 21, #PB_ComboBox_Editable)
  hWnd = GetWindow_(hWnd, #GW_CHILD)
  hWndEdit = FindWindowEx_(hWnd, 0, "EDIT", 0)
  oldcomboproc = SetWindowLong_(hWndEdit, #GWL_WNDPROC, @ComboAutoComplete())
Mein Problem ist nun das ich es einfach nicht gebacken bekomme, das Autocomplete und die Focus-Event-Behandlung zusammen zum laufen zu bekommen. Könnte mit hier bitte noch jemand behilflich sein.
Vielen vielen Dank.
Bild
Antworten