Lazarus

Programming => Widgetset => GTK => Topic started by: Eugene Loza on February 12, 2015, 09:55:24 am

Title: Form resize fails under Debian/Linux
Post by: Eugene Loza on February 12, 2015, 09:55:24 am
I'm not sure if the question relates to GTK2 widgetset or the linux compilation itself (the code works perfectly for windows)
I have a problem with the following code:
Code: [Select]
form1.endFormUpdate;
{$IFDEF UNIX}form1.BorderStyle:=bsnone;{$ENDIF}
form1.width:=cellsize*maxx+2;
form1.height:=cellsize*maxy+button1.height+4+image1.height+3;
{$IFDEF UNIX}form1.BorderStyle:=bssingle;{$ENDIF}
As seen, I have to make borderstyle:=bsnone to resize the form. With bssingle (also default) it just remains the same size.
The more strange phenomenon is that this problem occured here the day before yesterday. Before it was resizing fine with bssingle before. Maybe the problem is in introduction of beginformupdate...endformupdate before this code?

The complete source may be found here: http://sourceforge.net/projects/metarsweeper/files/Source/MetarSweeper_source_150212-1.tar.gz/download It's a minesweeper game.

Lazarus V.1.2.4
Title: Re: Form resize fails under Debian/Linux
Post by: zeljko on February 12, 2015, 12:54:08 pm
bsSingle and bsDialog aren't resizable during runtime (they have fixed w/h). This is so at least with gtk2 and qt. I think it's delphi compatibile behaviour.
Title: Re: Form resize fails under Debian/Linux
Post by: Eugene Loza on February 12, 2015, 01:19:39 pm
The problem is ... they WERE resizable two days ago.  8)
Title: Re: Form resize fails under Debian/Linux
Post by: zeljko on February 12, 2015, 03:58:17 pm
The problem is ... they WERE resizable two days ago.  8)

Have you changed lazarus version in the meantime ? I don't know if it was implemented during 1.2.4, take a look at svn browser.
Title: Re: Form resize fails under Debian/Linux
Post by: Eugene Loza on February 13, 2015, 07:25:38 am
No, version didn't change. It was the same computer with the same lazarus version 1.2.4. The Debian was not updated during this period.
The changes were made in the program. Introduced beginformupdate/endformupdate (however, removing this back doesn't make the form resize normally), made dynamic form objects generation 'as needed', not 'onformcreate'. Hmmm... the project was updated and saved in lazarus 1.2.6 32bit/windows. Maybe here could be the cause...
I'm gonna try installing newer lazarus version at work today.
Title: Re: Form resize fails under Debian/Linux
Post by: Eugene Loza on February 14, 2015, 09:49:31 am
Nope... 1.2.6 didn't help...
neither putting a form1.Resize; or form1.autosize:=true;

Also tried to remove all anchors. The result is the same.
However, the objects on the form (anchored buttons, labels, images) behave like the form has been resized and move to their 'correct' anchor position for the specified form width/height, but quickly revert back if the form is moved.
(UPD) setting form.borderstyle=bssizeable; also works like bsnone. But I need non-resizable form.
Title: Re: Form resize fails under Debian/Linux
Post by: Windsurfer on February 14, 2015, 11:14:47 am
I have a similar problem. A working piece of code suddenly stopped working in qt and GTK2, but still works in Windows. Perhaps the following will help.

I read in the wiki or forum:
1) using the form resize event does not always work as expected in non Windows widget sets;
2) to use Clientwidth and Clientheight to allow for theme borders;
3) to resize the Picture.Bitmap, rather than the original bitmap;

I started from the beginning with a piece of test code, which is attached. It works in all widget sets, and allows tests with three different resize events, but I am still looking for my problem, which appears to be caused by drawing to an area that is not in memory.
Title: Re: Form resize fails under Debian/Linux
Post by: zeljko on February 14, 2015, 10:28:10 pm
I have a similar problem. A working piece of code suddenly stopped working in qt and GTK2, but still works in Windows. Perhaps the following will help.

 It could be a bug. Better create test project which used to work in the past and open an issue about it.
Title: Re: Form resize fails under Debian/Linux
Post by: Eugene Loza on February 19, 2015, 11:13:25 am
no... still no luck... tried many possible combinations, but it fails. I think I should just rewrite everything from a scratch (in a more optimal way) and see if the same problem persists...
Title: Re: Form resize fails under Debian/Linux
Post by: Windsurfer on February 22, 2015, 11:12:47 am
I have isolated the bug to  procedure that works when called the first time. It only fails when called from a resize event. The error is a SIGSEGV, which means a memory fault. It does not happen with Windows, only qt and GTK2. I have created a new test app but have not yet repeat the fault. I' will keep looking.
Title: Re: Form resize fails under Debian/Linux
Post by: Windsurfer on February 25, 2015, 10:45:38 pm
I have installed Lazarus 1.4 RC, and the SIGSEGV on resize problem seems to be fixed.
TinyPortal © 2005-2018