Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-07

Thought for multi-platform

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jeff Wormsley
to Baeseman, Cliff: I do not think you can nest them like that... Not sure either maybe someone can give some…

Try like this... No Else, move the Endif for GTK. Also, where are you doing the {$define GTK} and the others?

Jeff.

unit interfaces;
{$mode objfpc}
interface
{$ifdef read_interface}
{$ifdef GTK}
uses gtk,gdk,glib,mesages,gtkint;
type
TInterfaceObject = class(gtkObject)
	public
	  constructor Create;override;
  	  destructor Destroy; override;
	end;
Var
InterfaceObject : TInterfaceObject;
{$endif GTK}
{$ifdef QT}
uses Messages;
type
TInterfaceObject = class(QTObject)
	public
	  constructor Create;override;
  	  destructor Destroy; override;
	end;
Var
InterfaceObject : TInterfaceObject;
{$endif QT}
{$endif read_interface}
implementation
{$ifdef read_implementation}
constructor TInterfaceObject.Create;
	Begin
	Inherited Create;
	End;
destructor TInterfaceObject.Destroy;
	Begin
	Inherited Destroy;
	End;
{$endif read_implementation}
end.

Reply by email

Shane Miller

Here's some more info on what I am thinking. Take a look at the following code and you'll get a better idea of my thoughts.

unit interfaces;
{$mode objfpc}
interface
{$ifdef read_interface}
{$ifdef GTK}
uses gtk,gdk,glib,mesages,gtkint;
type
TInterfaceObject = class(gtkObject)
	public
	  constructor Create;override;
  	  destructor Destroy; override;
	end;
Var
InterfaceObject : TInterfaceObject;
{$else}
{$ifdef QT}
uses Messages;
type
TInterfaceObject = class(QTObject)
	public
	  constructor Create;override;
  	  destructor Destroy; override;
	end;
Var
InterfaceObject : TInterfaceObject;
{$endif}
{$endif}
{$endif read_interface}
implementation
{$ifdef read_implementation}
constructor TInterfaceObject.Create;
	Begin
	Inherited Create;
	End;
destructor TInterfaceObject.Destroy;
	Begin
	Inherited Destroy;
	End;
{$endif read_implementation}
end.

problem is I can't get this to work. It compiles but when I add interfaces.pp to controls.pp uses clause and try to use a InterfaceObject variable it says that InterfaceObject variable does not exist.

Any help on this would be greatly appreciated seeing as though I've never really used ifdef statements before.

Shane

Reply by email

Shane Miller

Yes it did. I have Lazarus generically created WITH the generic language modules setup. The DEFINE is in the interfaces.pp file. Later it'll be difined in the IDE at compile time..... Sorry, but I attached the source. It's small and I didn't want to add it to CVS because it really doesn't do anything (not like CVS version does much)

Take a and gtkint.pp They are the new files of interest.

Please take a look at this and let me know your opinions. My code IS messy and undocumented...have to go play golf now...

Shane

>> "Jeff Wormsley" 07/01 2:31 PM >>>
Shane Miller wrote
You will be able to do the ($DEFINE} in the compiler. For now I'll hard code it in the source though.....

That's fine for now. Did the rearrangement help get you compiling?

Jeff.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: zip00006.zip
Type: application/octet-stream
Size: 48952 bytes
Desc: "PKZIP (compressed) files"
Url : http://localhost/pipermail/lazarus/attachments/19990701/0f760e06/zip00006.obj

Reply by email

Shane Miller

In reference to this message, the statement

"Now IntSendMessage is contained in a interface.pp file (or something near that name). In it all we have is the following:"

is incorrect. IntSendMessage is defined in the gtkobject class or qtobject class. Interface.pp is only used to determine which class we will be using....

Sorry for the confusion..

Shane

>> "Shane Miller" 07/01 9:28 AM >>>

Can I get some opinions on this idea please....

In TForms (for example) in TForms create we can put a function called IntSendMessage (for interface send message) with parameters of Message (in this case it would be LM_CREATE to create a form), CompStyle (in this case csForm) , and the last parameter will be either a pointer or a handle to the new component.

So TForm.Create would be:

ConstructorTForm.Create(AOwner : TComponent);
Begin
Inherited Create(AOwner);
IntSendMessage(LM_Create, csForm,fComponent);
Left := 0;
Top := 0;
Width := 100
Height := 125;
end;

The resize would be handled like this:

Procedure TForm.SetLeft(Value : Integer);
Begin

IntSendMessage(LM_ResizeLeft,Value,fComponent)

end;

or something like that.

Now IntSendMessage is contained in a interface.pp file (or something near that name). In it all we have is the following:

ifdefine gtk
Interfaceobject = class(gtkobject)

ifdefine qt
InterfaceObject = class(qtObject

etc...

(the defines aren't perfect pascal...sorry, not sure how to do that exaclty)

then in a gtkint.pp file we have a class called gtkobject that contains the IntSendMessage and in a qtint.pp file we have a qtobject class with the same procedure......

We could then simply create a new ??int.pp file and add a new define to the interface.pp file when we wanted to expand our platforms....

Don't flame me too badly now. I've only spent 5 minutes on this. Thoughts?

Shane

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Shane Miller

Can I get some opinions on this idea please....

In TForms (for example) in TForms create we can put a function called IntSendMessage (for interface send message) with parameters of Message (in this case it would be LM_CREATE to create a form), CompStyle (in this case csForm) , and the last parameter will be either a pointer or a handle to the new component.

So TForm.Create would be:

ConstructorTForm.Create(AOwner : TComponent);
Begin
Inherited Create(AOwner);
IntSendMessage(LM_Create, csForm,fComponent);
Left := 0;
Top := 0;
Width := 100
Height := 125;
end;

The resize would be handled like this:

Procedure TForm.SetLeft(Value : Integer);
Begin

IntSendMessage(LM_ResizeLeft,Value,fComponent)

end;

or something like that.

Now IntSendMessage is contained in a interface.pp file (or something near that name). In it all we have is the following:

ifdefine gtk
Interfaceobject = class(gtkobject)

ifdefine qt
InterfaceObject = class(qtObject

etc...

(the defines aren't perfect pascal...sorry, not sure how to do that exaclty)

then in a gtkint.pp file we have a class called gtkobject that contains the IntSendMessage and in a qtint.pp file we have a qtobject class with the same procedure......

We could then simply create a new ??int.pp file and add a new define to the interface.pp file when we wanted to expand our platforms....

Don't flame me too badly now. I've only spent 5 minutes on this. Thoughts?

Shane

Reply by email

Baeseman, Cliff

I do not think you can nest them like that... Not sure either maybe someone can give some insight...

Cliff

Earlier message 83 lines
-----Original Message----- From: Shane Miller Sent: Thursday, July 01, 1999 1:04 PM To: Subject: Re: [lazarus] Thought for multi-platform Here's some more info on what I am thinking. Take a look at the following code and you'll get a better idea of my thoughts. unit interfaces; {$mode objfpc} interface {$ifdef read_interface} {$ifdef GTK} uses gtk,gdk,glib,mesages,gtkint; type TInterfaceObject = class(gtkObject) public constructor Create;override; destructor Destroy; override; end; Var InterfaceObject : TInterfaceObject; {$else} {$ifdef QT} uses Messages; type TInterfaceObject = class(QTObject) public constructor Create;override; destructor Destroy; override; end; Var InterfaceObject : TInterfaceObject; {$endif} {$endif} {$endif read_interface} implementation {$ifdef read_implementation} constructor TInterfaceObject.Create; Begin Inherited Create; End; destructor TInterfaceObject.Destroy; Begin Inherited Destroy; End; {$endif read_implementation} end. problem is I can't get this to work. It compiles but when I add interfaces.pp to controls.pp uses clause and try to use a InterfaceObject variable it says that InterfaceObject variable does not exist. Any help on this would be greatly appreciated seeing as though I've never really used ifdef statements before. Shane _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email