Re: [Lazarus] New methods code creation

2016-10-19 Thread Mattias Gaertner via Lazarus
On Mon, 26 Sep 2016 13:04:29 -0700
Aradeonas via Lazarus  wrote:

> > I personally prefer to use private as default. I will add the option.  
> 
> Me too, at least an option for an useful shortcut.
> Happy to hear that.

I added it.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] ActiveX, TOLEControl

2016-10-19 Thread Dennis via Lazarus



LacaK via Lazarus wrote:






Hi *,

I need help with OCX component (not visual I guess), which I need 
use in Lazarus application (to control another application, which 
supplies this OCX control).
I have imported type library using importtl.exe (new unit was 
created successfully)


Then in program I have created instance:
  v := CreateOleObject('SCAPS.ScSamlightClientCtrl');
or
  intf := CreateComObject(CLASS_ScSamlightClientCtrl) as 
_DSamlight_client_ctrl_ocx;

What is the type of your V or intf  variable?


V: OLEVariant;
intf: _DSamlight_client_ctrl_ocx;

I am wild guessing maybe they are not proper referenced type so the 
object is created and then immediately freed.


There is something strange behind scene. I have tried various methods:
I remember in Delphi, I sometimes have to call CoInitialize and 
CoUninitialize.

Not sure if FPC has to do the same.
Have you tried that?

Dennis
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] ActiveX, TOLEControl

2016-10-19 Thread LacaK via Lazarus






Hi *,

I need help with OCX component (not visual I guess), which I need use 
in Lazarus application (to control another application, which 
supplies this OCX control).
I have imported type library using importtl.exe (new unit was created 
successfully)


Then in program I have created instance:
  v := CreateOleObject('SCAPS.ScSamlightClientCtrl');
or
  intf := CreateComObject(CLASS_ScSamlightClientCtrl) as 
_DSamlight_client_ctrl_ocx;

What is the type of your V or intf  variable?


V: OLEVariant;
intf: _DSamlight_client_ctrl_ocx;

I am wild guessing maybe they are not proper referenced type so the 
object is created and then immediately freed.


There is something strange behind scene. I have tried various methods:

var
  v1: OLEVariant;
  v2: ScSamlightClientCtrl;
  v: variant;
  ax: TActiveXContainer;
  disp: IDispatch;
  i: integer;

begin
  v1 := CreateOLEObject('SCAPS.ScSamlightClientCtrl');
  i := v1.scIsRunning;  // exception here

  v2 := CoScSamlightClientCtrl.Create;
  i := v2.scIsRunning;  // exception here

  ax := TActiveXContainer.Create(Self);
  //ax.OleClassName := 'SCAPS.ScSamlightClientCtrl';
  CoCreateInstance(CLASS_ScSamlightClientCtrl, nil, 
CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER, IDispatch, disp);

  ax.ComServer:=disp;
  ax.Active := True;
  v := disp;
  i := v.scIsRunning;  // exception here

So in every case it returns exception when I try call first time 
interface method ...

I am not familiar with ActiveX technology so I have no idea what is wrong ?

-Laco.

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Trunk - Index Out Of Bounds error

2016-10-19 Thread Mattias Gaertner via Lazarus
On Tue, 18 Oct 2016 13:17:03 +0100
Graeme Geldenhuys via Lazarus  wrote:

> Hi,
> 
> I've just upgraded to Lazarus Trunk. If I now add a package dependency
> to my project I get an index out of bounds error. I don't see the
> package add - in the Project Inspector window either, but apparently it
> is there. If I quit and restart Lazarus IDE, then the package dependency
> magically appears.
> 
> I'm using Lazarus 1.7 r53133 FPC 2.6.4 x86_64-freebsd-gtk 2

It works here with FPC 3.0.
Maybe happens only with FPC 2.6.4.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] ActiveX, TOLEControl

2016-10-19 Thread Dennis via Lazarus



LacaK via Lazarus wrote:

Hi *,

I need help with OCX component (not visual I guess), which I need use 
in Lazarus application (to control another application, which supplies 
this OCX control).
I have imported type library using importtl.exe (new unit was created 
successfully)


Then in program I have created instance:
  v := CreateOleObject('SCAPS.ScSamlightClientCtrl');
or
  intf := CreateComObject(CLASS_ScSamlightClientCtrl) as 
_DSamlight_client_ctrl_ocx;

What is the type of your V or intf  variable?
I am wild guessing maybe they are not proper referenced type so the 
object is created and then immediately freed.


I would try
  v : OLEVariant;
or V :  _DSamlight_client_ctrl_ocx;

Dennis
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus