Re: [Lazarus] Viewing interface object in debugger

2012-10-19 Thread Martin

On 19/10/2012 00:20, Benito van der Zander wrote:

type
ITest = interface
end;
TTest = class(TInterfacedObject, ITest)
  a: integer;
end;

var c : TTest;
i : ITest;
begin
  c := TTest.Create;
  c.a := 42;
  i := c;
  writeln(c.a);
end.


Evaluating i only shows ITEST = {
IUNKNOWN = {},
  }

but what I want to see is something like it prints for c (or both 
together):


TTEST = {
TINTERFACEDOBJECT = {
TOBJECT = {
  _vptr$TOBJECT = $671c10},
FREFCOUNT = 1,
REFCOUNT = 1},
  A = 42}


(although I just noticed that ttest((pointer(i)) - 0x20) prints that, 
but is that reliable?

it will probably break if a class implements multiple interfaces)



My research shows, that the offset is variable (depends on size of class 
and amount of interfaces). Also it can not be derived, except by 
disassembling.
As for the memory layout, the answer is always do not rely on it. It has 
gone wrong for others before.



However in gdb there is a way to get the class name (but not the instance)
info symbol ppointer(i)^
VTBL_UNIT1_TMYCLASS_$_IMYDELEGATE in section .data of 
B:/tmp/interface/project1.exe

You can see the address has debug info, and it includes the class name.
However since pascal identifiers can have underscores too, extracting 
the name may not always be simple



As for the data. WARNING: applies only to current fpc(s). May change at 
any time, even depending on settings, or target CPU... Who knows.

The variable points to the Virtual message table of the interface.
Disassemble one of the methods:
disassemble (^ppointer(intfdelegate)^+3)^
Dump of assembler code for function 
WRPR_UNIT1_TMYCLASS_$_IMYDELEGATE_$_3_$_UNIT1_TMYCLASS_$__DOTHIS$LONGINT:

   0x004287e0 +0:  sub$0xc,%eax
   0x004287e3 +3:  jmp0x428710 TMYCLASS__DOTHIS
the first sub gives the offset = 12.

So as a human, you can try to find it.
But since nothing of this is reliable, it will not be implemented.

You can ask the fpc team, to add the offset to the data structure, in a 
way that is guaranteed not to change.



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


Re: [Lazarus] VirtualTreeView bug

2012-10-19 Thread ik
On Fri, Oct 19, 2012 at 2:58 AM, luiz americo pereira camara
luiz...@oi.com.br wrote:


 2012/10/18 ik ido...@gmail.com


 I attched it to here, hopefully others might also see and might find
 that I do something wrong, if it's not a bug


 Replace Widestring references by String

Thanks, that solved it. When was it changed ?


 Luiz

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


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


Re: [Lazarus] VirtualTreeView bug

2012-10-19 Thread luiz americo pereira camara
2012/10/19 ik ido...@gmail.com

 On Fri, Oct 19, 2012 at 2:58 AM, luiz americo pereira camara
 luiz...@oi.com.br wrote:
 
 
  2012/10/18 ik ido...@gmail.com
 
 
  I attched it to here, hopefully others might also see and might find
  that I do something wrong, if it's not a bug
 
 
  Replace Widestring references by String

 Thanks, that solved it. When was it changed ?


More than 3 years ago (widestring had been replaced even before):

http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/virtualtreeview-new/VirtualTrees.pas?view=logpathrev=1034

The demo code in wiki is based in the original VTV port

Luiz
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Cannot build lazarus 1.0.2 with fpc 2.6.0

2012-10-19 Thread Luca Olivetti
I installed fpc 2.6.0 with the rpm (32 bits) from freepascal.org.
Got lazarus 1.0.2 sources from svn.

First problem:

Free Pascal Compiler version 2.6.0 [2011/12/23] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling interfaces.pas
Compiling gtk2wsstdctrls.pp
gtk2wsstdctrls.pp(1528,26) Error: Incompatible types: got Boolean32 expected 
LongInt
gtk2wsstdctrls.pp(2687) Fatal: There were 1 errors compiling module, stopping

Ok, changed gTrue to 1 (maybe the fpc-2.6.0 rpm was build with -dnoboolean32?)

Second problem (which I'm stuck at):

Free Pascal Compiler version 2.6.0 [2011/12/23] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling ideintf.pas
Compiling actionseditor.pas
Compiling componenteditors.pas
Compiling propedits.pp
Compiling frmselectprops.pas
Compiling idewindowintf.pas
idewindowintf.pas(1169,33) Error: identifier idents no member DesktopLeft
idewindowintf.pas(1170,36) Error: identifier idents no member DesktopLeft
idewindowintf.pas(1173,34) Error: identifier idents no member DesktopTop
idewindowintf.pas(1174,39) Error: identifier idents no member DesktopTop
idewindowintf.pas(1177,39) Error: identifier idents no member DesktopLeft
idewindowintf.pas(1184,40) Error: identifier idents no member DesktopTop
idewindowintf.pas(2067,18) Error: identifier idents no member WorkAreaRect
idewindowintf.pas(2096) Fatal: There were 7 errors compiling module, stopping


Bye
-- 
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004 (Ext.133)  Fax +34 93 5883007

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


[Lazarus] What's going on with GTK on lazarus 1.0.2 from SVN?

2012-10-19 Thread Krzysztof
Hi,

Are some serious changes implementing in GTK interface right now? I'm
the author and maintainer of BGRA Controls package which are using
BGRA Bitmap package for drawing. Issues:

1. First, I can't compile BGRA Bitmap package without comment line:

{ifdef LCL_GTK2}
type TGtkDeviceContext = TGtk2DeviceContext;
{$endif}

What happened with TGtk2DeviceContext? This same with other non-BGRA
controls like VirtualTreeView (but there is more GTK errors than only
TGtk2DeviceContext )

2. BGRA Controls are using simple BGRA Bitmap api for drawing:
BGRABitmap.Draw(Canvas, 0,0,false). This code worked from a several
years, but now seems that GTK coordinates are different. If I drag (or
in runtime) some BGRA Control on center of the form, I don't see what
is drawed, just transparent frame, but If I move control to left-top
corner then I see control body. Seems that GTK is starting drawing
from form canvas, not control.

I notified this a few days ago, I thought that this is some temporary
issue, but with today trunk is the same problem.

Regards, Dibo

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


Re: [Lazarus] Cannot build lazarus 1.0.2 with fpc 2.6.0

2012-10-19 Thread Luca Olivetti
Al 19/10/12 20:51, En/na Luca Olivetti ha escrit:
 I installed fpc 2.6.0 with the rpm (32 bits) from freepascal.org.
 Got lazarus 1.0.2 sources from svn.

My fault: I used svn switch to update my repository, and obviously that's not 
the correct way to do it.
With a fresh checkout everything is fine.
Sorry for the noise.
-- 
Luca

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


[Lazarus] Checkbox value in TDrawGrid

2012-10-19 Thread Leonardo M . Ramé
Hi, is there a method to set/get the value of a checkbox in a TDrawGrid,
when the column's buttonStyle was declared as cbsCheclBoxColumn?.


-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [Lazarus] Checkbox value in TDrawGrid

2012-10-19 Thread Jesus Reyes


--- El vie 19-oct-12, Leonardo M. Ramé l.r...@griensu.com escribió:

 De: Leonardo M. Ramé l.r...@griensu.com
 Asunto: [Lazarus] Checkbox value in TDrawGrid
 A: Lazarus mailing list lazarus@lists.lazarus.freepascal.org
 Fecha: viernes, 19 de octubre de 2012, 15:08
 Hi, is there a method to set/get the
 value of a checkbox in a TDrawGrid,
 when the column's buttonStyle was declared as
 cbsCheclBoxColumn?.
 

Since r39142 DrawGrid have the events OnGetCheckboxState and OnSetCheckboxState 
previously available only in StringGrid.


Jesus Reyes A.



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


Re: [Lazarus] TDBNavigator icons break symmetry

2012-10-19 Thread Ajeandro Gonzalo
Does anyone have a source fot suitable icons (also i need a gear one)?
Maybe put them in a zip file and attach thwm to a message?  Or upload to a free 
host like http://www.zippyshare.com?

Thanks.

A. G.

--- On Sat, 10/13/12, Bart bartjun...@gmail.com wrote:

 From: Bart bartjun...@gmail.com
 Subject: Re: [Lazarus] TDBNavigator icons break symmetry
 To: Lazarus mailing list lazarus@lists.lazarus.freepascal.org
 Date: Saturday, October 13, 2012, 5:15 AM
 On 10/10/12, Graeme Geldenhuys gra...@geldenhuys.co.uk
 wrote:
  On 2012-10-09 23:12, Bart wrote:
 
  File a feature request in the bugtracker?
  Otherwise it will be forgotten.
 
  http://bugs.freepascal.org/view.php?id=23097
 
 
 I implemented it in r39065.
 Please test and report any bugs.
 
 Bart
 
 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
 

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