[lazarus] Patches to Shanes files

Shane Miller SMiller1 at stvgb.org
Wed Jul 7 15:36:37 EDT 1999


OK, i am still having that problem so any help would be appreciated.

Michael, I have another thought for you.  Tell me why this wouldn't be better.
In SetCallback we are sent a signal name plus a Sender.  We connect the signal to a procedure,
depending on what signal is equal to, and we send it SENDER.  All the procedure does is do a TControl(data).DispatchStr(signal). How about this.  Instead of doing a 

gtk_signal_connect(gobject,gsignal,gtk_signal_func(depends on what signal is), Sender)

we do this:
Procedure SetCallBack(Signal : String; Sender : TControl);
type
TMsg : record
  Name : String;
  Sender : TControl;
  end;
pMsg = ^TMsg;

Var
 Msg : pMsg;

Begin

Msg.Name := Signal;
Msg.Sender := Sender;

gtk_signal_connect(gobject,gsignal,gtk_signal_func(GlobalSignalFunction), Msg)


end;

Then we only have one procedure that does all the dispatching.

Procedure GlobalSugnalFunction(widget : pgtkWidget ; MSG : Pointer);
type
TMsg : record
  Name : String;
  Sender : TControl;
  end;
pMsg = ^TMsg;

Var
Sender : TControl;
Name : String;
begin
Name := pMsg(MSG)^.Name;
Sender:= pMsg(MSG)^.Sender;

TControl(Sender).DispatchStr(Name);
end;

Now we would have to probably still do a case statement in the SetCallBack to assign the signal to a different procedure if it requires different parameters, but most signals require the same thing.

Thoghts?

Shane











More information about the Lazarus mailing list