Re: [Lazarus] scrolling still doesn't work with LHelp on Win 7 64bit

2012-10-17 Thread Reinier Olislagers
On 16-10-2012 21:19, Ajeandro Gonzalo wrote:
 Thank you for fixing the scrolling problem with LazReports Preview.
 
 Please do the same with LHelp!
 
 A..
If you don't get a response on this post: please post bug reports on the
bug tracker - they'll be forgotten if sent to the mailing list.

Thanks,
Reinier


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


Re: [Lazarus] Fwd: Build-Depends: imagemagick

2012-10-17 Thread Kamen Ketev
 is the 0.9.30 version from the Debian repositories better than the


0.9.30 from the Ubuntu repositories? 
I don't know. I am using USU, which I think is based on Ubuntu and using
 Ubuntu repositories. 
Lazarus

  0.9.30.2 was installed by default, compiles empty project. If don't use gdb 
or install manually like suggested in previously mail project run. I remove
  
Lazarus

  0.9.30.2. Install fpc, fpc-src and Lazarus 1.0.2 from sf. Install gdb
  
  as suggested in previously mail. Empty project runs without problem. I was 
trying to import test graphical project (digital clock) but visualization was 
only for circle. Arrows not shown. I think this is because I am new and can't 
transfer from win to linux. Is there a way to automatically compile from 
Windows to Linux?
  



 



 Оригинално писмо 
От:  Bernd  
Относно: Re: [Lazarus] Fwd: Build-Depends: imagemagick
До: Lazarus mailing list  
Изпратено на: Понеделник, 2012, Октомври 15 15:57:21 EEST


2012/10/15 Kamen Ketev  kamenl...@abv.bg :



 I install Lazarus from  Debian Repository  under Ubuntu and compyle new

 project without problem.



is the 0.9.30 version from the Debian repositories better than the

0.9.30 from the Ubuntu repositories? The Ubuntu version is missing all

.lpk files in the components directory and because of this refusing to

start without errors, it is missing a dependency on fpc-source which

must therefore be installed manually, it is constantly trying to save

a config file /usr/lib/lazarus/0.9.30.2/JCFSettings.cfg which is of

course not writable by user and if you finally get it running it will

not compile anything - not even the empty default project - because it

cannot find unit interfaces.



--

___

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] Fwd: Build-Depends: imagemagick

2012-10-17 Thread Bernd
2012/10/17 Kamen Ketev kamenl...@abv.bg:

 Arrows not shown. I think this is because I am new and can't transfer from
 win to linux. Is there a way to automatically compile from Windows to Linux?

Its more complicated to set up a working cross-compiler from windows
to linux than the other way around, installing and using the cross
compiler on linux is much simpler. But this will not help with the
subtle differences that different LCL widgetsets are having, they are
not intentional (some of them are bugs) but some subtle differences in
behavior simply cannot be avoided, you will still have to test your UI
on Windows and Linux separately.

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


Re: [Lazarus] Fwd: How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-17 Thread Mattias Gaertner

[...]
 2012/10/16 Mattias Gaertner nc-gaert...@netcologne.de:

  OPT=-g- -Xs
 
  Why?

 I'm still working on it on my local pc (with rather slow disk) and
 want fast compiles and small files. Also because I do not actually use
 the compiled units I am only interested in a stripped lazarus binary,
 for running on the build farm (which are much more powerful machines)
 I would even add -CX -XX here.

I thought this is a proposal for better standard debian packages. The normal
Lazarus user needs debug.


  override_dh_auto_clean:
  $(MAKE) -C $(ORIG) cleanbigide distclean
  find $(ORIG) -name *.a -exec rm {} \;
  $(RM) $(ORIG)/lazarus
  $(RM) $(ORIG)/startlazarus
  $(RM) $(ORIG)/lazbuild
  $(RM) -r /tmp/lazarus
 
  Better start with an svn export.

 This is again a convenience for me doing repeated builds on my local
 machine. On the build server the $(ORIG) folder will contain a freshly
 unzipped upstream tarball or for my nightly fixes on launchpad it will
 contain a fresh snapshot of the fixes branch (this is created newly
 every time by a bzr-builder recipe from a mirror of the lazarus fixes
 branch in the launchpad bzr repository).

 This could be created by a separate script when run locally (it may
 *not* happen inside rules because the build servers do not have access
 to anything other than what is contained in the source package when
 the build has started)

ok, so not for the standard debian packages.


  # we do not need to install any of the compiled units because
  # they are never used, they would be a waste of disk space.
  # everything will be compiled on demand into ~/.lazarus/lib/
  find $(ORIG) -name *.ppu -exec rm {} \;
  find $(ORIG) -name *.o -exec rm {} \;
  find $(ORIG) -name *.a -exec rm {} \;
 
  Maybe not a good idea: The compile takes a lot of time, on multi user
  systems
  (e.g. student pools) you get duplicates, home can be on a network share
  (slow).

 This is a valid point. But is it really significant for most users or
 for typical users nowadays? At one point (when they change lazarus
 build options) it will compiled into ~/.lazarus/ anyways. And its
 really fast, even on my very old laptop and happens only for the very
 first time (and then only after options have changed but this would
 happen anyways). On the other hand all the above brings down my entire
 deb package to only 45MB and reduces installed size in /usr/share
 greatly.

True. But Lazarus and fpc easily need one or two GB, so 45MB is not that much.
And it is some kind of show stopper if the IDE recompiles everything to install
one package.
Of course the binary will be smaller and some users have slow internet.
So it has pros and cons. I can live with it.


  # we cannot directly install into $(ROOT)/usr
  # because lazarus make install is broken (copy into itself)
  # so we install into a temp dir outside of this tree
  # please fix this in lazarus makefile
  $(MAKE) -C $(ORIG) install PREFIX=/tmp/lazarus/usr
 
  This works here:
  sudo make install

 no, it cannot work.

You lost me here. How can something not work that just worked?


 The typical setup for package building is that
 $(ORIG) and $(CURDIR) are identical (debian folder is in the same
 directory as the top level makefile). Actually I made this distinction
 between $(ORIG) and $(CURDIR) only because I need to workaround it for
 my nightlies because of the existing debian folder (i complained
 about) i cannot merge upstream and my own packaging, so i nest entire
 upstream into a subdirectory but I do this only for the nightlies and
 this is a very ugly hack and I ultimately want to avoid it. Ideally
 and normally $(ORIG) and $(CURDIR) are identical.

 And when ./debian/lazarus/usr/ is a subfolder of ./ then the following
 cp -r . ./somewhere/ will fail with error about recurively copying a
 folder into a subdirectory of itself. It should instead copy only what
 it needs explicitly.

I'm not sure I can follow you here. How can I reproduce the bug?


  # install forgot to install desktop start menu item
  # please fix this in lazarus makefile
  mkdir -p $(ROOT)/usr/share/applications
  mkdir -p $(ROOT)/usr/share/pixmaps
  cp $(ORIG)/install/lazarus.desktop $(ROOT)/usr/share/applications/
  convert $(ORIG)/images/icons/aqua.ico[0]
  $(ROOT)/usr/share/pixmaps/lazarus.png
 
  Do not use 'cp'. Use 'install':

 yes, you are right, install would be better.

  # the following is INCOMPLETE and its only a dirty workaround!
  # create most probably needed unit directories for rebuilding ide
  # the ide - when building itself - will try to mkdir -p them
 
  ok

 mkdir -p unit output directory seems to happen though some
 autogenerated (by fpcmake) snippet of makefile code that is
 automatically in all fpcmake Makefiles, it will probably not be easy
 to remove it.

Don't try. Just create the output directories to make mkdir -p happy. They don't
hurt.


Mattias

--
___
Lazarus mailing list

Re: [Lazarus] Fwd: How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-17 Thread Bernd
2012/10/17 Mattias Gaertner nc-gaert...@netcologne.de:

 True. But Lazarus and fpc easily need one or two GB, so 45MB is not that much.
 And it is some kind of show stopper if the IDE recompiles everything to 
 install
 one package.
 Of course the binary will be smaller and some users have slow internet.
 So it has pros and cons. I can live with it.

Yesterday after doing more rigorous attempts to remove *all* binaries
from the install directory (so that contents of /usr/share/ becomes
truly architecture independent which is a *must* and the very
definition and purpose of /usr/share/) I noticed that this gives some
more subtle problems, when restarting the IDE after successful rebuild
of the IDE it will look for startlazarus in the lazarus folder (and
not on the search path). Therefore I have for now decided to install
the entire lazarus into /usr/lib/lazarus and leave the executables it
is looking for where they are.

This would make it possible to leave also the compiled units in the
lazarus folder again (but of course only makes sense if I don't
compile them with custom options). In the end this is only a change of
one line in the rues file and does not break other things and it is
nice to know that it is at least possible to make such a stripped down
installer that still provides a fully functional Lazarus.

 I'm not sure I can follow you here. How can I reproduce the bug?

It is because of the typical directory layout when building a .deb
package. I will try to explain. Consider this simple hello world
directory layout after unzipping and preparing the source for package
building immediately before the actual build is started:

hello-world-1.0/debian/changelog
hello-world-1.0/debian/control
hello-world-1.0/debian/rules
hello-world-1.0/Makefile
hello-world-1.0/hello.lpi
hello-world-1.0/hello.lpr

after make all it might look like this:

hello-world-1.0/debian/changelog
hello-world-1.0/debian/control
hello-world-1.0/debian/rules
hello-world-1.0/Makefile
hello-world-1.0/hello.lpi
hello-world-1.0/hello.lpr
hello-world-1.0/hello.ppu
hello-world-1.0/hello.o
hello-world-1.0/hello

now it will call make install with PREFIX set to a special path that
it will later use to zip the installation contents. This PREFIX folder
is a subdirectory of the debian folder!

Our example makefile (just for illustration purpose) would for example
install into $(PREFIX)/lib/hello and also a symlink into $(PREFIX)/bin
so after make install it should look like this:

hello-world-1.0/debian/hello-world/usr/lib/hello/hello
hello-world-1.0/debian/hello-world/usr/bin/hello  - ../lib/hello/hello
hello-world-1.0/debian/changelog
hello-world-1.0/debian/control
hello-world-1.0/debian/rules
hello-world-1.0/Makefile
hello-world-1.0/hello.lpi
hello-world-1.0/hello.lpr
hello-world-1.0/hello.ppu
hello-world-1.0/hello.o
hello-world-1.0/hello

then after make install has completed debhelper tools will zip
everything below debian/hello-world/ and make it the data.tar.gz
member of the .deb

the reason why make install of lazarus fails is that at one point it does a

cp -r . $(PREFIX)/share/lazarus/

and with prefix set to ./debian/lazarus/usr this will expand like that:

cp -r . ./debian/lazarus/usr/share/lazarus/

which would attempt to copy the entire folder (*including* the debian
folder!) into a subdirectory of itself (into the debian folder) and
this will fail with error, cp will refuse to do this, it will start
copying a few files but then when it comes to copying the ./debian
folder into ./debian/lazarus/usr/share/lazarus/ it will abort with
error.

this can be avoided by either copying only the needed files
explicitly. I worked around this by installing into a temp dir
*outside* the current directory and then in a separate step moving it
back into ./debian/lazarus/usr where debhelper tools will expect it to
be and removing the debian directory (and other unwanted stuff) from
the final install directory again.

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


Re: [Lazarus] Fwd: How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-17 Thread Mattias Gaertner

Bernd prof7...@gmail.com hat am 17. Oktober 2012 um 12:15 geschrieben:
 2012/10/17 Mattias Gaertner nc-gaert...@netcologne.de:

  True. But Lazarus and fpc easily need one or two GB, so 45MB is not that
  much.
  And it is some kind of show stopper if the IDE recompiles everything to
  install
  one package.
  Of course the binary will be smaller and some users have slow internet.
  So it has pros and cons. I can live with it.

 Yesterday after doing more rigorous attempts to remove *all* binaries
 from the install directory (so that contents of /usr/share/ becomes
 truly architecture independent which is a *must* and the very
 definition and purpose of /usr/share/) I noticed that this gives some
 more subtle problems, when restarting the IDE after successful rebuild
 of the IDE it will look for startlazarus in the lazarus folder (and
 not on the search path). Therefore I have for now decided to install
 the entire lazarus into /usr/lib/lazarus and leave the executables it
 is looking for where they are.

Looking for startlazarus in the search path might find one of a different
version. Then you can get very strange errors. So if possible I would avoid
searching in path.


 This would make it possible to leave also the compiled units in the
 lazarus folder again (but of course only makes sense if I don't
 compile them with custom options). In the end this is only a change of
 one line in the rues file and does not break other things and it is
 nice to know that it is at least possible to make such a stripped down
 installer that still provides a fully functional Lazarus.

  I'm not sure I can follow you here. How can I reproduce the bug?

 It is because of the typical directory layout when building a .deb
 package. I will try to explain. Consider this simple hello world
 directory layout after unzipping and preparing the source for package
 building immediately before the actual build is started:

 hello-world-1.0/debian/changelog
 hello-world-1.0/debian/control
 hello-world-1.0/debian/rules
 hello-world-1.0/Makefile
 hello-world-1.0/hello.lpi
 hello-world-1.0/hello.lpr

 after make all it might look like this:

 hello-world-1.0/debian/changelog
 hello-world-1.0/debian/control
 hello-world-1.0/debian/rules
 hello-world-1.0/Makefile
 hello-world-1.0/hello.lpi
 hello-world-1.0/hello.lpr
 hello-world-1.0/hello.ppu
 hello-world-1.0/hello.o
 hello-world-1.0/hello

 now it will call make install with PREFIX set to a special path that
 it will later use to zip the installation contents. This PREFIX folder
 is a subdirectory of the debian folder!

 Our example makefile (just for illustration purpose) would for example
 install into $(PREFIX)/lib/hello and also a symlink into $(PREFIX)/bin
 so after make install it should look like this:

 hello-world-1.0/debian/hello-world/usr/lib/hello/hello
 hello-world-1.0/debian/hello-world/usr/bin/hello - ../lib/hello/hello
 hello-world-1.0/debian/changelog
 hello-world-1.0/debian/control
 hello-world-1.0/debian/rules
 hello-world-1.0/Makefile
 hello-world-1.0/hello.lpi
 hello-world-1.0/hello.lpr
 hello-world-1.0/hello.ppu
 hello-world-1.0/hello.o
 hello-world-1.0/hello

 then after make install has completed debhelper tools will zip
 everything below debian/hello-world/ and make it the data.tar.gz
 member of the .deb

 the reason why make install of lazarus fails is that at one point it does a

 cp -r . $(PREFIX)/share/lazarus/

 and with prefix set to ./debian/lazarus/usr this will expand like that:

 cp -r . ./debian/lazarus/usr/share/lazarus/

 which would attempt to copy the entire folder (*including* the debian
 folder!) into a subdirectory of itself (into the debian folder) and
 this will fail with error, cp will refuse to do this, it will start
 copying a few files but then when it comes to copying the ./debian
 folder into ./debian/lazarus/usr/share/lazarus/ it will abort with
 error.

 this can be avoided by either copying only the needed files
 explicitly. I worked around this by installing into a temp dir
 *outside* the current directory and then in a separate step moving it
 back into ./debian/lazarus/usr where debhelper tools will expect it to
 be and removing the debian directory (and other unwanted stuff) from
 the final install directory again.

I did the explicit approach.

Mattias

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


[Lazarus] GUI selection to install bigide packages

2012-10-17 Thread Reinier Olislagers
Hi list,

I may be missing something but suppose you have a bare Lazarus where you
removed a lot of packages.
Is there a way in the GUI to select the packages in make bigide (e.g.
sqldb)?

I know I can run make bigide myself, but it is a graphical IDE after all ;)

(Alternatively and quite possibly, I've again overlooked something
obvious. If so, I'd be happy to be corrected ;) )

Thanks,
Reinier

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


Re: [Lazarus] Fwd: How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-17 Thread Bernd
2012/10/17 Mattias Gaertner nc-gaert...@netcologne.de:

 Looking for startlazarus in the search path might find one of a different
 version. Then you can get very strange errors. So if possible I would avoid
 searching in path.

This should not be possible since the deb would have installed its own
startlazarus symlink into /usr/bin

There is one more minor problem with startlazarus I noticed: If
lazarus folder is /usr/share/lazarus and startlazarus and lazarus
executables exist in lazarus folder and custom built lazarus is in
~/.lazarus/ then startlazarus will ask the user which lazarus to start
(the system installed or the one in the config directory).

But when the entire lazarus folder is in /usr/lib/lazarus (exact same
direcrory layout, only everything in /usr/lib instead of /usr/share
then startlazarus will always immediately start the custom built
lazarus in ~/.lazarus all the time without asking. This is not a big
problem since this is what the user most likely wanted to do anyways
and relatively easily circumvent by starting lazarus-ide (which points
to /usr/lib/lazarus/lazarus) from the command line but I think
(without looking at the code now) this means that there are still some
hardcoded paths in startlazarus where to look for the natively
installed lazarus (instead of using the lazarus dir setting and
finding it in /usr/lib/lazarus)

Now  if I make an (almost empty) folder /usr/share/lazarus and copy
only the two binaries (startlazarus and lazarus) over to
/usr/share/lazarus (but not making any config changes, just put copies
of those two binaries there) then starting startlazarus (when started
from within /usr/shar/lazarus) will again open the question dialog.
(but the one in /usr/lib/lazarus will still not see it, it only works
when started from within /usr/share/lazarus!)

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


Re: [Lazarus] Can you reproduce the following Access Violation ?

2012-10-17 Thread Corpsman

if i write
Type
  TForm1 = Class(TForm);

  TSomeClass = Class
  private
  public

  End;

  TForm1 = Class(TForm)
  private
{ private declarations }
  public
{ public declarations }
  End;

set a Tbutton on the TForm1 and double click ( to create the OnClick Event )

I get also the exception :

The component editor of class TDefaultComponentEditor has created the 
error:
Unable to create new method. Please fix the error shown in the message 
window, which is normally below the source editor.


Lazarus 1.1 r39114M Free Pascal Compiler version 2.6.0-1 [2012/01/13] for i386

Corpsman on Kubuntu 12.04


On 10/17/2012 06:28 PM, ik wrote:

Hello,

When I write something like so:

-
type
   TForm1 = class(TForm);

   TSomeClass = class
   ...
   end;

   TForm1 = class(TForm)
   ...
   end;


--

If I try to rename a component in design time (Other then the form
itself), it will throw at me Access Violation.

I'm using: Lazarus 1.1 r39114M FPC 2.6.0 x86_64-linux-gtk 2

Can you reproduce the following issue (So I could report a bug), or am
I missing something here ?

Thanks,
Ido

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




--

Auf meiner Homepage www.Corpsman.de ist immer was los, ständig wird sie 
aktualisiert und erweitert. Da ist für jeden was dabei.


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


Re: [Lazarus] Can you reproduce the following Access Violation ?

2012-10-17 Thread John Landmesser

Am 17.10.2012 18:50, schrieb Corpsman:
set a Tbutton on the TForm1 and double click ( to create the OnClick 
Event )


I get also the exception :

The component editor of class TDefaultComponentEditor has created 
the error:
Unable to create new method. Please fix the error shown in the 
message window, which is normally below the source editor.


Lazarus 1.1 r39114M Free Pascal Compiler version 2.6.0-1 [2012/01/13] 
for i386


Corpsman on Kubuntu 12.04





TButton on Form and double click:
No probs with
Lazarus 1.1 r39114M FPC 2.6.0 i386-linux-gtk 2

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


Re: [Lazarus] Can you reproduce the following Access Violation ?

2012-10-17 Thread ik
On Wed, Oct 17, 2012 at 6:50 PM, Corpsman corps...@web.de wrote:
 if i write
 Type
   TForm1 = Class(TForm);

   TSomeClass = Class
   private
   public

   End;

   TForm1 = Class(TForm)
   private
 { private declarations }
   public
 { public declarations }
   End;

 set a Tbutton on the TForm1 and double click ( to create the OnClick Event )

 I get also the exception :

 The component editor of class TDefaultComponentEditor has created the
 error:
 Unable to create new method. Please fix the error shown in the message
 window, which is normally below the source editor.

 Lazarus 1.1 r39114M Free Pascal Compiler version 2.6.0-1 [2012/01/13] for
 i386

 Corpsman on Kubuntu 12.04

I have reported it: http://bugs.freepascal.org/view.php?id=23148




 On 10/17/2012 06:28 PM, ik wrote:

 Hello,

 When I write something like so:

 -
 type
TForm1 = class(TForm);

TSomeClass = class
...
end;

TForm1 = class(TForm)
...
end;


 --

 If I try to rename a component in design time (Other then the form
 itself), it will throw at me Access Violation.

 I'm using: Lazarus 1.1 r39114M FPC 2.6.0 x86_64-linux-gtk 2

 Can you reproduce the following issue (So I could report a bug), or am
 I missing something here ?

 Thanks,
 Ido

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



 --

 Auf meiner Homepage www.Corpsman.de ist immer was los, ständig wird sie
 aktualisiert und erweitert. Da ist für jeden was dabei.


 --
 ___
 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


[Lazarus] Working with threads and GUI

2012-10-17 Thread ik
Hello,

I'm writing an application that need to perform a counter on big
numbers (0..n).
I wish to display the counter on screen, but also allow to stop the
process itself.

At the moment I did something like:

for i := 0 to Number do
  begin
edtValue.text := IntToStr(Number);
application.processmessages;
sleep(200);
  end;

How can I use it under a thread that the view will be updated in the
form, but I could also cancel the action on a very long action ?

Thanks,
Ido

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


Re: [Lazarus] Can you reproduce the following Access Violation ?

2012-10-17 Thread stdreamer

On 17/10/2012 7:28 μμ, ik wrote:

Hello,

When I write something like so:

-
type
   TForm1 = class(TForm);

   TSomeClass = class
   ...
   end;

   TForm1 = class(TForm)
   ...
   end;


--

If I try to rename a component in design time (Other then the form
itself), it will throw at me Access Violation.

I'm using: Lazarus 1.1 r39114M FPC 2.6.0 x86_64-linux-gtk 2

Can you reproduce the following issue (So I could report a bug), or am
I missing something here ?

Thanks,
Ido

I am guessing that the 1st TForm1 declaration mend to be a forward 
declaration.

In that case you have defined it wrong.
Tform1 = class(Tform);
is equal to
TForm1 = class(TForm)
end;
and not a forward declaration. In your case you have 2 components 
defined with the same name in the same unit and probably creates conflicts.

try to change the first declaration to
TForm1 = class;
and see what happens.



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


Re: [Lazarus] Working with threads and GUI

2012-10-17 Thread stdreamer

On 17/10/2012 10:29 μμ, ik wrote:

Hello,

I'm writing an application that need to perform a counter on big
numbers (0..n).
I wish to display the counter on screen, but also allow to stop the
process itself.

At the moment I did something like:

for i := 0 to Number do
   begin
 edtValue.text := IntToStr(Number);
 application.processmessages;
 sleep(200);
   end;

How can I use it under a thread that the view will be updated in the
form, but I could also cancel the action on a very long action ?

Thanks,
Ido
Create a new application in lazarus copy and paste the following in the 
body of the main form that was created for you.
Make sure that the form events are linked correctly in the object 
inspector and run the application.
Watch the caption change as the thread executes its loop when you get 
bored double click the form to end the thread.

It has been tested on windows 7 32bit.

{--- FROM HERE 
}


uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, LMessages,
LCLIntf, LCLType;

const
cMesg = LM_USER+1;
type

{ TmyThread }

TmyThread = class(TThread)
private
FForm : TForm;
FNumber : Int64;
FStoped : Boolean;
FCS : LCLType.TCriticalSection;
function GetStoped : Boolean;
procedure SetStoped(aValue : Boolean);
protected
property Stoped : Boolean read GetStoped write SetStoped;
public
procedure Execute; override;
constructor Create(CreateSuspended: Boolean;
aForm:TForm; aNumber:Int64;
const StackSize: SizeUInt = DefaultStackSize);
destructor Destroy; override;
procedure StopExec;
end;

{ TForm1 }

TForm1 = class(TForm)
procedure FormActivate(Sender : TObject);
procedure FormCreate(Sender : TObject);
procedure FormDblClick(Sender : TObject);
private
{ private declarations }
FThread : TmyThread;
public
{ public declarations }
procedure ThreadMsg(var aMsg:TLMessage); message cMesg;
procedure ThreadDone(Sender:TObject);
end;

var
Form1 : TForm1;

implementation

{ TForm1 }

procedure TForm1.FormActivate(Sender : TObject);
begin
If not assigned(FThread) then begin
FThread := TmyThread.Create(True,Self,1000);
FThread.OnTerminate := @ThreadDone;
FThread.FreeOnTerminate := True;
FThread.Resume;
end;
end;

procedure TForm1.FormCreate(Sender : TObject);
begin
Caption := Caption+'- Thread Exited.';
end;

procedure TForm1.FormDblClick(Sender : TObject);
begin
if Assigned(FThread) then FThread.StopExec;
end;

procedure TForm1.ThreadMsg(var aMsg : TLMessage);
begin
Caption := IntToStr(aMsg.wParam);
end;

procedure TForm1.ThreadDone(Sender : TObject);
begin
FThread := Nil;
Caption := Caption + ' - Thread Exited';
end;

{$R *.lfm}
{ TmyThread }

procedure TmyThread.SetStoped(aValue : Boolean);
begin
EnterCriticalsection(FCS);
try
if FStoped = aValue then Exit;
FStoped := aValue;
finally
LeaveCriticalSection(FCS);
end;
end;

function TmyThread.GetStoped : Boolean;
begin
EnterCriticalsection(FCS);
try
Result := FStoped;
finally
LeaveCriticalSection(FCS);
end;
end;

procedure TmyThread.Execute;
var
Cntr : Int64;
begin
Cntr := 0;
While (Cntr  FNumber) and (not Stoped) do begin
Inc(Cntr);
if Assigned(FForm) then PostMessage(FForm.Handle,cMesg,Cntr,0);
Sleep(500);
end;
end;

constructor TmyThread.Create(CreateSuspended : Boolean; aForm : TForm;
aNumber : Int64; const StackSize : SizeUInt);
begin
FForm := aForm;
FNumber := aNumber;
LCLIntf.InitializeCriticalSection(FCS);
FStoped := False;
inherited Create(CreateSuspended, StackSize);
end;

destructor TmyThread.Destroy;
begin
LCLIntf.DeleteCriticalSection(FCS);
inherited Destroy;
end;

procedure TmyThread.StopExec;
begin
EnterCriticalsection(FCS);
try
fStoped := True;
finally
LeaveCriticalsection(FCS);
end;
end;

end.

{--- TO HERE 
-}




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


Re: [Lazarus] How do I fix win32object.inc errors compiling Win64 Lazarus trunk+FPC trunk?

2012-10-17 Thread Reinier Olislagers
On 11-10-2012 19:29, Marco van de Voort wrote:
 On Thu, Oct 11, 2012 at 10:25:17AM +0200, Reinier Olislagers wrote:
 IMHO, that patch is correct, except:
 * use UINTPTR instead of THandle as record field.
 * make sure it still compiles/runs with fpc 2.6.0, at least as good as
 the current version.

 Thanks, Vincent ;)

 Patch attached to issue, compiles both on x64/fpctrunk and x86 FPC 2.6.1.
 
 Note that it is scheduled to be merged to fixes in a few weeks.

Noticed backport to FPC 2.6.1; updated patch attached to issue
http://bugs.freepascal.org/view.php?id=23052

Suggest it be applied and marked for inclusion in Lazarus fixes.

Thanks,
Reinier


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