[lazarus] Compiling

Pavlovic Ivan vampir at EUnet.yu
Fri Dec 1 12:16:09 EST 2000


Friday, 01 December 2000, 16:50:35, you wrote:

SM> Cool.  Thanks.  I got it to work with the visible property and the NAME property but doing the CAPTION causes it to crash.  Trying to do the TOP parameter does nothing along with HINT and a few
SM> others.

SM> Not sure why.  
SM> Feel free to examine my code.  I will continue to look at it.

SM> Shane


>>>> michael.vancanneyt at wisa.be 12/01/00 07:44AM >>>


SM> On Fri, 1 Dec 2000, Shane Miller wrote:

>> Question for all:  
>> 
>> Using RTTI howdo I set a property value?
>> In my source code for TComponentInterface.SetPropbyName
>> I get the PPropinfo record for the property VISIBLE and
>> I check the Setproc variable.  It's <> nil so I need
>> to call it somehow.  I have a TMySetProc type that is a
>> 
>> Procedure (const value) of Object;
>> 
>> In TComponentInterface I have a variable MySetProc of type TMySetProc.  I assign MySetProc by....
>> 
>> MySetProc := TMySetProc(SetProc^);
>> 
>> then I call it
>> 
>> MySetProc(Value);
>> 
>> It crashes.  Thoughts?

SM> The correct way to do this is using setordprop:

SM> procedure SetOrdProp(Instance : TObject;PropInfo : PPropInfo;  Value : Longint);

SM> You could do like this;

SM> // Easy access function:

SM> function GetPropInfo(Instance: TObject; const PropName: string): PPropInfo;
SM> begin
SM>   Result := GetPropInfo(Instance.ClassType, PropName);
SM> end;

SM> Actual code:

SM> begin
SM>   SetOrdProp(Instance,GetPropInfo(Instance),Ord(Value))
SM> end;  

SM> Only use the SetXXXprop functions to set properties, don't start looking in
SM> the propinfo records.

SM> I will enhance the typinfo unit ASAP, so functions of the kind
SM> procedure SetSetProp(Instance: TObject; const PropName: string;const Value: string);

SM> are available. They were introduced in Delphi 5 as well; you could then
SM> use these functions.

SM> Michael.

SM> _________________________________________________________________
SM>      To unsubscribe: mail lazarus-request at miraclec.com with
SM>                 "unsubscribe" as the Subject
Hi, I've just downloaded lazarus from CVS and tried to compile it
using "make all" but it says that there is a reference (in global.pp)
to a unit named designerform.pp which does not exist... It says
something like 'DesignerForm searched but Designer found'... Am I
doing something wrong (I forgot to say that I'm using Linux RedHat 7
and official FPC 1.0)


-- 
Pavlovic Ivan

Mail:
----
vampir at tesla.rcub.bg.ac.yu
vampir at eunet.yu
vampir at net.yu

Homepage:
----
http://www.tisoft.cjb.net







More information about the Lazarus mailing list