[fpc-devel] Bug in trunk?

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Mar 28 12:25:14 CET 2008


On 28/03/2008, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
> It compiles again. Unrelated (because I think such declarations are
>  broken for fpu types/values): what code do you have to write so that
>  this default value is actually used?

fpGUI's UI Designer generates GUI code directly in the .pas unit, not
via BinaryObjectToText() etc.. It checks the default value of a
property before it decides to generate code or not.  Here is an
example of a Boolean property.


function TPropertyBoolean.GetPropertySource(wg: TfpgWidget; const
ident: string): string;
var
  i: integer;
  s: string;
  PropInfo: PPropInfo;
begin
  PropInfo := GetPropInfo(wg.ClassType, Name);
  i := GetOrdProp(wg, Name);
  if PropInfo^.Default <> i then
  begin
    if i = 1 then
      s := 'True'
    else
      s := 'False';
    Result := ident + Name + ' := ' + s + ';' + LineEnding;
  end
  else
    Result := '';
end;


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list