LM_SELCHANGE send OnSelectionChange and next OnClick, but not only in
Qt also in GTK.

Bug or feature?

2006/9/19, Felipe Monteiro de Carvalho <[EMAIL PROTECTED]>:
Ok, something very strange is going on.

I added a slot for the itemchanged signal that looks like this:

procedure TQtListWidget.SlotSelectionChange(current: QListWidgetItemH;
  previous: QListWidgetItemH); cdecl;
var
  Msg: TLMessage;
begin
  FillChar(Msg, SizeOf(Msg), #0);

  Msg.Msg := LM_SELCHANGE;

  try
    LCLObject.WindowProc(TLMessage(Msg));
  except
    Application.HandleException(nil);
  end;
end;

If I comment out the LCLObject.WindowProc() line, no events are
received for the listbox.

If I don't commen it and click on the list box and drag to change
selection, I will receive many OnClick and OnSelectionChange events.

Could it be a problem with the qt bindings?

It seams to me everything I did was correct. Here is my SetSlots
function, I not only use a events look, but alse set a slot for a
signal directly, because that signal has no corresponding event:

class procedure TQtWSCustomListBox.SetSlots(const QtListWidget: TQtListWidget);
var
  Method: TMethod;
  Hook : QListWidget_hookH;
begin
  // Various Events

  Hook := QListWidget_hook_create(QtListWidget.Widget);

  TEventFilterMethod(Method) := QtListWidget.EventFilter;

  QObject_hook_hook_events(Hook, Method);

  // OnSelectionChange event

  QListWidget_currentItemChanged_Event(Method) :=
QtListWidget.SlotSelectionChange;

  QListWidget_hook_hook_currentItemChanged(Hook, Method);
end;

I also attached a diff.
--
Felipe Monteiro de Carvalho





--
http://luisdigital.com

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to