Re: [Lazarus] MacOSAll.pas has invalid UTF-8 characters

2008-10-23 Thread Graeme Geldenhuys
On Thu, Oct 23, 2008 at 12:48 AM, Mattias Gaertner
[EMAIL PROTECTED] wrote:

 AFAIK the original c header files are UTF-8 encoded.
 Maybe the translation utility did some conversion.

That's probably what happened then.


 Lazarus opens it as ISO-8859-1, which allows even some basic editing
 without loosing/destroying data.

Most editors don't have issues opening that file, but if you browse it
you can see the odd characters (quite a few) that seems out of place.
kwrite makes them easy to spot - it highlights them with a ? on a
black circle. In Lazarus IDE they mostly appear as a 'A' character
with a small circle above it. I don't believe that was in the original
C header file.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] MacOSAll.pas has invalid UTF-8 characters

2008-10-23 Thread Graeme Geldenhuys
On Wed, Oct 22, 2008 at 1:48 PM, Graeme Geldenhuys
[EMAIL PROTECTED] wrote:
 Hi,

 From what I can gather the following unit seems to have invalid UTF-8 
 characters
  fpc/packages/univint/src/MacOSAll.pas

I only noticed now... I posted this in the wrong mailing list. It was
meant for the FPC-Devel list.  Sorry for the noise.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Issue with IDispatch.Invoke: Can't set Word.Application.Visible to false?

2008-10-23 Thread Thierry Coq

Hello,

I've trying to connect to a Word or Excel application with Lazarus 0.9.26.
The IDispatch does not work,
I've tried going to the Invoke API, and it still doesn't work.
I'm able to create a Word.Application objet, I'm even able to get the 
pointer to the Visible property.

I just can't set the Visible property to true: I get the error message:

// -2147352572 = DISP_E_PARAMNOTFOUND: parameter not found

Please see attached code.



Does somebody know how to call Invoke on IDispatch or better still, 
how to call directly methods and properties of Word or Excel objects in 
Lazarus?


BR
Thierry

object Form1: TForm1
  Left = 332
  Height = 300
  Top = 158
  Width = 400
  Caption = 'Form1'
  ClientHeight = 300
  ClientWidth = 400
  ParentFont = False
  LCLVersion = '0.9.26'
  object Button1: TButton
Left = 96
Height = 25
Top = 70
Width = 75
Caption = 'Test'
OnClick = Button1Click
TabOrder = 0
  end
  object Memo1: TMemo
Left = 24
Height = 141
Top = 121
Width = 272
Lines.Strings = (
  'Memo1'
)
TabOrder = 1
  end
end
{ Ceci est un fichier ressource généré automatiquement par Lazarus }

LazarusResources.Add('TForm1','FORMDATA',[
  'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'L'#1#6'Height'#3','#1#3'Top'#3#158#0#5'Wi'
  +'dth'#3#144#1#7'Caption'#6#5'Form1'#12'ClientHeight'#3','#1#11'ClientWidth'#3
  +#144#1#10'ParentFont'#8#10'LCLVersion'#6#6'0.9.26'#0#7'TButton'#7'Button1'#4
  +'Left'#2'`'#6'Height'#2#25#3'Top'#2'F'#5'Width'#2'K'#7'Caption'#6#4'Test'#7
  +'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#5'TMemo'#5'Memo1'#4'Left'#2
  +#24#6'Height'#3#141#0#3'Top'#2'y'#5'Width'#3#16#1#13'Lines.Strings'#1#6#5'Me'
  +'mo1'#0#8'TabOrder'#2#1#0#0#0
]);
unit FMainTestWord;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
  private
{ private declarations }
  public
{ public declarations }
  end; 

var
  Form1: TForm1; 

implementation

uses Windows, Variants, ComObj, ActiveX;
{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
const
  ServerName = 'Word.Application';
var
  Server : OleVariant;
  Id : TCLSID;
  GuID : TGUID;
  aServer : IDispatch;
  aResult: HRESULT;
  Member: WideString;
  lDispID: Integer;
  Params: TDispParams;
  ExceptInfo : TExcepInfo;
  VarResult: OleVariant;
  ArgErr : DWord;
  LocalVariantArg : array[0..3] of TPROPVARIANT;
  dispidNamed :  DISPID;
begin
  if Assigned(InitProc) then
TProcedure(InitProc);

  aServer := nil;
  Id := ProgIDToClassID(ServerName);
  GuID := ProgIDToClassID(ServerName);
  dispidNamed := DISPATCH_PROPERTYPUT;
  Member := 'Visible';
  ldispID := 0;

  FillChar(ExceptInfo, SizeOf(ExcepInfo),0);
  FillChar(Params, SizeOf(DispParams),0);
  FillChar(LocalVariantArg,SizeOf(LocalVariantArg),0);
  Params.rgvarg := @LocalVariantArg;

  Memo1.Lines.Clear;
  try
//Server := CreateOleObject(ServerName);
//Server := CreateComObject(GuiD);

   aResult := CoCreateInstance(GuiD,nil,CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER, IDispatch, aServer);
   Memo1.Lines.Add('CoCreateInstance Result =' +IntToStr(aResult));


   //aServer.QueryInterface(IDispatch,Server)
   //Server := aServer;
  except
Memo1.Lines.Add('Unable to start Word.');
Exit;
  end;

  //Server.Visible := True;  {Make Word visible}
  aResult := aServer.GetIDsOfNames(GUID_NULL, @Member, 1, LOCALE_USER_DEFAULT, @lDispID);
  Memo1.Lines.Add('GetIDsOfNames on Visible Result =' +IntToStr(aResult));


  (* Params.rgvarg[0].VT := varError;
  Params.rgvarg[0].scode := DISP_E_PARAMNOTFOUND;
  Params.rgvarg[1].VT := varError;
  Params.rgvarg[1].scode := DISP_E_PARAMNOTFOUND;*)

  // the first parameter is a bool
  LocalVariantArg[0].VT := VT_BOOL;
  LocalVariantArg[0].boolVal := True;
  Params.cArgs := 1;
  Params.cNamedArgs := 1;
  Params.rgdispidNamedArgs:= @dispidNamed;

  aResult := aServer.Invoke( lDispID, GUID_NULL, 0, DISPATCH_PROPERTYPUT, Params,
 @VarResult, @ExceptInfo, @ArgErr);
  Memo1.Lines.Add('Invoke on Visible Result =' +IntToStr(aResult));
  // -2147024809 = COR_E_ARGUMENT: wrong parameters
  // -2147352572 = DISP_E_PARAMNOTFOUND: parameter not found


  {Open existing document}  //Substitute your path and doc
  //Server.Documents.Open('c:\Test.doc');

end;

initialization
  {$I FMainTestWord.lrs}

end.

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Carbon PPC: Blue-ish images from ImageList

2008-10-23 Thread mitya boyarintsev
The bug is probably caused by internal image translation and processing.

If images are processed as 4 or 2 byte integers (Longword, word), not as a
sequence of bytes, the  code is simply not cross platform (not cross CPU at
least). because PPC is big-endian CPU, while Intel (that is the primary for
LCL component)s) in little-endian. Pixels can be placed in different oreder
not RGB, but BGR (or vice versa)

AFAIK, Mac OS provides routines for CGImages to handle this cross-CPU
situation. Intel-based images can be processed correclty on PPC. So little
fix would be required for Cabon wigdetset.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] MacOSAll.pas has invalid UTF-8 characters

2008-10-23 Thread JoshyFun
Hello Graeme,

Thursday, October 23, 2008, 9:24:30 AM, you wrote:

GG Most editors don't have issues opening that file, but if you browse it
GG you can see the odd characters (quite a few) that seems out of place.
GG kwrite makes them easy to spot - it highlights them with a ? on a
GG black circle. In Lazarus IDE they mostly appear as a 'A' character
GG with a small circle above it. I don't believe that was in the original
GG C header file.

That character ($C5) seens to be some kind of mask character in MacOS,
and it is being used in the comments as just a mask, replacing it by
'*' will clarify the meaning (something like)


API_CALL_*_*
First piece is the function name, second one the encoding.


Using * you will interpret it correctly ;)

-- 
Best regards,
 JoshyFun

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Lazarus on x86 Slackware 12.1

2008-10-23 Thread Mark Morgan Lloyd
I'm currently trying to build Lazarus 0.9.26 on Slackware 12.1, which 
appears to have a fairly clean set of gtk 2.0 libraries unlike Debian 
which has a lot of 1.2 stuff.

I think I need to create a manual symlink

libgdk_pixbuf.so - libgdk_pixbuf-2.0.so

However even with this I get:

Linking ../lazarus
/usr/local/share/lazarus-0.9.26-0/lcl/units/i386-linux/gtk/gtkdebug.o: 
In function `ONDBGDRAWAREAEXPOSE':
gtkdebug.pp:107: undefined reference to 
`gdk_pixbuf_render_to_drawable_alpha'
/usr/local/share/lazarus-0.9.26-0/lcl/units/i386-linux/gtk/gtkproc.o: In 
function `CREATEPIXBUFFROMDRAWABLE':
gtkproc.inc:5624: undefined reference to `gdk_pixbuf_get_from_drawable'
/usr/local/share/lazarus-0.9.26-0/lcl/units/i386-linux/gtk/gtkextra.o: 
In function `GDK_PIXBUF_RENDER_PIXMAP_AND_MASK':
gtk1extra.inc:497: undefined reference to 
`gdk_pixbuf_render_pixmap_and_mask'
lazarus.pp(122,1) Error: Error while linking
lazarus.pp(122,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[2]: *** [lazarus] Error 1
make[2]: Leaving directory `/usr/local/share/lazarus-0.9.26-0/ide'
make[1]: *** [ide] Error 2
make[1]: Leaving directory `/usr/local/share/lazarus-0.9.26-0/ide'
make: *** [ide] Error 2

Does anybody have any suggestions please?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] MacOSAll.pas has invalid UTF-8 characters

2008-10-23 Thread Mattias Gaertner
On Thu, 23 Oct 2008 16:53:42 +0200
JoshyFun [EMAIL PROTECTED] wrote:

 Hello Graeme,
 
 Thursday, October 23, 2008, 9:24:30 AM, you wrote:
 
 GG Most editors don't have issues opening that file, but if you
 GG browse it you can see the odd characters (quite a few) that seems
 GG out of place. kwrite makes them easy to spot - it highlights
 GG them with a ? on a black circle. In Lazarus IDE they mostly
 GG appear as a 'A' character with a small circle above it. I don't
 GG believe that was in the original C header file.
 
 That character ($C5) seens to be some kind of mask character in MacOS,
 and it is being used in the comments as just a mask, replacing it by
 '*' will clarify the meaning (something like)
 
 
 API_CALL_*_*
 First piece is the function name, second one the encoding.
 
 
 Using * you will interpret it correctly ;)

Yes, please put this on the fpc bug tracker.

Mattias

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] MacOSAll.pas has invalid UTF-8 characters

2008-10-23 Thread Graeme Geldenhuys
On Thu, Oct 23, 2008 at 9:34 PM, Mattias Gaertner
[EMAIL PROTECTED] wrote:
 That character ($C5) seens to be some kind of mask character in MacOS,
 and it is being used in the comments as just a mask, replacing it by
 '*' will clarify the meaning (something like)

 
 API_CALL_*_*
 First piece is the function name, second one the encoding.
 

 Using * you will interpret it correctly ;)

 Yes, please put this on the fpc bug tracker.

OK. Reported as follows:
  http://bugs.freepascal.org/view.php?id=12474


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] How to mimic MWSnap's Window Information feature on X11

2008-10-23 Thread Graeme Geldenhuys
Hi,

MWSnap is an excellent screenshot capture program for the Windows
platform. It includes a few other nice features as well. One of them
is a Window Information feature. Awesome feature to spy on other
software to get an idea how how the created the GUI layout. :-)
I would like to try and write a utility for X11 platform to do the
same. Anybody got any ideas how to do it?

* In MWSnap when you select Window Information feature, it seems to
take a snapshot of the desktop. I tested this by enabling the seconds
in the date/time display. The seconds stop ticking as soon as I select
Window Information feature.
* As you move the mouse over the screen, it displays information about
that window (handle, class, co-ordinates, dimensions etc).
* *This* is the real feature I'm trying to duplicate. As you move the
mouse, it draws a rectangle around the window area it's giving
information about.
  eg: The button in a ComboBox or a Button or Edit on a Form etc.. The
following link shows what I'm trying to accomplish.
  http://opensoft.homeip.net/~graemeg/mwsnap_screenshot.png

Has anybody written such a tool, or know of an existing tool that does
this?  Anybody know how MWSnap manages to do the above and how I could
do the same for X11?  I would guess Felipe's Magnifier application
will give some hints on capturing the screen, but what about the other
parts?

Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Rotated text ?

2008-10-23 Thread Michael Van Canneyt

Hi,

Is it possible to draw text at a 90° angle ?

Michael.___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to mimic MWSnap's Window Information feature on X11

2008-10-23 Thread Michael Schneider
Am Donnerstag, 23. Oktober 2008 23:36:01 schrieb Graeme Geldenhuys:

 Has anybody written such a tool, or know of an existing tool that does
 this?  

 Regards,
   - Graeme -

Ksnapshot?

http://docs.kde.org/stable/en/kdegraphics/ksnapshot/

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotated text ?

2008-10-23 Thread Michael Schneider
Am Freitag, 24. Oktober 2008 00:05:07 schrieb Michael Van Canneyt:
 Hi,

 Is it possible to draw text at a 90° angle ?

 Michael.

Take a look at TOvcRotatedLabel


http://wiki.lazarus.freepascal.org/OrphPort

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus on x86 Slackware 12.1

2008-10-23 Thread Andrew Haines
Mark Morgan Lloyd wrote:

 Does anybody have any suggestions please?

   


Try

make LCL_PLATFORM=gtk2

Regards,

Andrew
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Possible bug with 0.9.26

2008-10-23 Thread Terry A. Haimann
I have a test app that uses the dbnavigator control.  The DBNavigator 
control has an OnClick event.  When I run this through Lazarus it hangs, 
but if I run the compiled program from a command prompt it runs fine.  
So I am assuming the problem is in the debugger.

Environment:   FC 8, Lazarus 0.9.26
Components in this app:
TMySQL50
TSQLTransaction
TSQQLQuery
TDatasource

All of the database components are on a separate form, which I 
understand is now ok to do.  I have tried removing the statements from 
the procedure that is called by OnClick (Just a Begin and End) and the 
program still hangs when run through Lazarus.

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Possible bug with 0.9.26

2008-10-23 Thread matt shaffer
Just out of curiosity, did you do Run-run or Run-Build file? Run-run has
always been buggy for me, so I just do run-build file and then run the
file.

On Thu, Oct 23, 2008 at 6:05 PM, Terry A. Haimann
[EMAIL PROTECTED]wrote:

 I have a test app that uses the dbnavigator control.  The DBNavigator
 control has an OnClick event.  When I run this through Lazarus it hangs,
 but if I run the compiled program from a command prompt it runs fine.
 So I am assuming the problem is in the debugger.

 Environment:   FC 8, Lazarus 0.9.26
 Components in this app:
TMySQL50
TSQLTransaction
TSQQLQuery
TDatasource

 All of the database components are on a separate form, which I
 understand is now ok to do.  I have tried removing the statements from
 the procedure that is called by OnClick (Just a Begin and End) and the
 program still hangs when run through Lazarus.

 ___
 Lazarus mailing list
 Lazarus@lazarus.freepascal.org
 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotated text ?

2008-10-23 Thread Felipe Monteiro de Carvalho
2008/10/23 Michael Van Canneyt [EMAIL PROTECTED]:
 Is it possible to draw text at a 90° angle ?

We support the winapi CreateFontIndirectEx for that (that's what
TOvcRotatedLabel uses). It's in the LclIntf unit. Read the winapi
docs.

It is planned to also support something like TFont.Orientation, but I
think it wasn't yet implemented.

-- 
Felipe Monteiro de Carvalho

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Rotated text ?

2008-10-23 Thread Paul Ishenin
Michael Van Canneyt wrote:
 Hi,
 
 Is it possible to draw text at a 90° angle ?

Yes. Gtk1 does not support it but win32, qt and gtk2 supports.

You can find an example in the TDockHeader.Draw method (ldocktree.pas).

Best regards,
Paul Ishenin.

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to mimic MWSnap's Window Information feature on X11

2008-10-23 Thread Funky Beast
Graeme Geldenhuys wrote:
 Hi,
 
 MWSnap is an excellent screenshot capture program for the Windows
 platform. It includes a few other nice features as well. One of them
 is a Window Information feature. Awesome feature to spy on other
 software to get an idea how how the created the GUI layout. :-)
 I would like to try and write a utility for X11 platform to do the
 same. Anybody got any ideas how to do it?
 
 * In MWSnap when you select Window Information feature, it seems to
 take a snapshot of the desktop. I tested this by enabling the seconds
 in the date/time display. The seconds stop ticking as soon as I select
 Window Information feature.
 * As you move the mouse over the screen, it displays information about
 that window (handle, class, co-ordinates, dimensions etc).
 * *This* is the real feature I'm trying to duplicate. As you move the
 mouse, it draws a rectangle around the window area it's giving
 information about.
   eg: The button in a ComboBox or a Button or Edit on a Form etc.. The
 following link shows what I'm trying to accomplish.
   http://opensoft.homeip.net/~graemeg/mwsnap_screenshot.png
 
 Has anybody written such a tool, or know of an existing tool that does
 this?  Anybody know how MWSnap manages to do the above and how I could
 do the same for X11?  I would guess Felipe's Magnifier application
 will give some hints on capturing the screen, but what about the other
 parts?
 
 Regards,
   - Graeme -
 
 
 ___
 fpGUI - a cross-platform Free Pascal GUI toolkit
 http://opensoft.homeip.net/fpgui/
 ___
 Lazarus mailing list
 Lazarus@lazarus.freepascal.org
 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
 

Hi,

Try wininfo, its included in most distros.
To find out how they do it, you can get the source from:
http://www.freedesktop.org/Software/wininfo

HTH,
Funky Beast
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to mimic MWSnap's Window Information feature on X11

2008-10-23 Thread Felipe Monteiro de Carvalho
Lazarus supports screenshot taking, so this part is easy. If you are
using pure X11 then take a look at the gtk2 implementation for
screenshots, it uses x11.

Next you take the mouse position and give to a X11 routine to get the
window. I don't know which routine to use, but surely there is one,
and further using X11 you can get the size of the window.

Then you have a fullscreen app, draw the screenshot and then draw a
rectangle making the window look selected. You can further draw
anything else. This is how the Virtual Magnifying Glass works (I draw
a glass instead of rectangles and texts)

You can also do that with hardware overlays (so you don't need a
screenshot, and the background is still alive), but it's a real
painful thing to implement, requiring special hardware and offering
tons of headackes, so I recomend in screenshot method =)

-- 
Felipe Monteiro de Carvalho
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus