* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: PopupMenu Creation OnClick Error
« Last post by Handoko on Today at 04:01:29 am »
OnClick has to be a method, not common standalone procedure.

Read more here:
http://forum.lazarus.freepascal.org/index.php/topic,36677.msg244671.html#msg244671
2
General / PopupMenu Creation OnClick Error
« Last post by Bazzao on Today at 03:44:39 am »

I am designing a debug unit and trying to create a popup menu for use to access debug information.

unit tstDebugPop1;

{.MODE Delphi}
{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Menus;

var
  fPopMenu1 :TPopupMenu;
  gDebug    :TStringList;   


procedure CreatePopup;
var vItem:TMenuItem;
begin
  fPopMenu1:=TPopupMenu.Create(nil);
  vItem:=TMenuItem.Create(fPopMenu1);
  vItem.Caption:='&Show last';
  vItem.OnClick:=@DebugShowLast;
  fPopMenu1.Items.Add(vItem);
end;

CreatePopup is executed within the Initialization section of the unit.

An error occurs for the line:
  vItem.OnClick:=@DebugShowLast;
and shows the following error:
tstdebugpop1.pas(148,18) Error: Incompatible types: got "Pointer" expected "<procedure variable type of procedure(TObject) of object;Register>"

DebugShowLast is a procedure within the unit.

If I comment out that line, the program runs and the popup menu is created. I link the popup to the main form, and a right click produces the menu with the sole item "Show last". So the creation of the menu and item is working ok, but the link is not.

I have tried the Delphi modes and the {$mode objfpc}{$H+} mode above.

So what is wrong with:
  vItem.OnClick:=@DebugShowLast;   >:(

TIA

3
General / Re: What will happen with Lazarus/Freepascal with windows 10 s ?
« Last post by molly on Today at 03:25:06 am »
Revenue comes from the store, just as google play store and Aple app store and by in-software-purchases. It seems that most people allow themselves to be suckered into such things...

Apparently the OS is "free", and you can take that with a mountain of salt  :)
4
General / Re: Procedural type that includes itself as a parameter
« Last post by doconnor on Today at 03:20:16 am »
I very much would like to keep it all in one routine like molly suggests, but TBaseJSONReader only allows the parsing to go to the next step by returning from its KeyValue, StingValue, etc. methods. Molly doesn't have this problem because she is traversing the JSONData structure, and I'm trying to avoid building that structure.

I got it working with:

Code: Pascal  [Select]
  1. PJSONCallback = ^TJSONCallback;
  2. TJSONCallBack = procedure(const JSONValue : TJSONValue; CallBack : PJSONCallback) of object;

It's a good solution that doesn't require casting. I had forgotten that you can create pointer types before defining the type.

I found some odd bugs/unintended features.

When I call the callback function I have to use two "@"s

Code: Pascal  [Select]
  1. Callback(JSONValue,@@NextCallback);

The first one still returns the function pointer. I add two to get the pointer to the function pointer. This probably isn't a bug, just an oddity of the language.

When I try to use a record method as the callback function, I get this error.

Error: Incompatible types: got "TArrayOfObject.Scallback(const TJSONValue;PJSONCallback);" expected "<procedure variable type of procedure(const TJSONValue;PJSONCallback) of object;Register>"

However, when I use a record helper method, it works.
5
General / Re: What will happen with Lazarus/Freepascal with windows 10 s ?
« Last post by RAW on Today at 02:54:54 am »
 :D :D :D That's exactly what I always wanted...  :)

I guess WINDOWS 10 S will be FREEWARE or do they really want real money for it ???
6
General / Re: What will happen with Lazarus/Freepascal with windows 10 s ?
« Last post by molly on Today at 02:49:22 am »
It is all true RAW, that is if you believe what is written in wikipedia.

So basically when you bought yourself a windows 10s machine you have a very expensive minecraft device  :D
7
Third party / Re: ct2laz - convertor between CodeTyphon and Lazarus
« Last post by sam707 on Today at 02:47:34 am »
np @Avra, i would have fix it myself by using a xml parser package, but i also have no time atm.. wife, kidos, hollidays (house to remake some walls)

i'm much more busy on hollidays than at work (that kills me hahahaha)

I'd noticed also a "adLCL" and "LCL" requirement failing sometimes, lets keep in touch, when back at my office i'll dl your source code and read it deep

THANK YOU anyway for your great ct2laz  :-*
8
General / Re: What will happen with Lazarus/Freepascal with windows 10 s ?
« Last post by RAW on Today at 02:40:39 am »
If this is all true, then this will be a very limited WINDOWS version and smart people wouldn't want to use it I guess....

Maybe it will be the new WINDOWS 6 or 8 or "9" .... just kidding...  :D
9
Designer / Re: Delphi Forms
« Last post by molly on Today at 02:24:57 am »
Hi and welcome Degibbo,

Wiki entry on Delphi converter can be read here.

The converter can sometimes be a miss though. There are several threads available on the subject, so feel free to do a search or mention in case you run into problems.

Lazarus for Delphi users wiki entry (here) might be able to help you out as well.
10
Designer / Delphi Forms
« Last post by Degibbo on Today at 02:20:39 am »
G'day all,
Total newby here, just downloaded Lazarus yesterday, so please be kind.

I have a Delphi 2010 project that I need to modify with Lazarus, but the
forms files are binary, not text so don't show as visual forms with components.

Is there a simple way to get around this?

Cheers & thanks,
DG

PS, please advise if I am posting in the wrong area.
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus