[Lazarus] F1 on Linux I got 255

2016-01-29 Thread Andrea Mauri

Dear all,

lazarus 1.4.4 fpc 2.6.4
Under linux VirtualBox if I launch my application and press F1 I got key 
=255 instead key = 112


procedure TfrmMainMenu.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  // check for F1
  if (Key = VK_F1) then
  begin
//dosomething
  end;
end;

why?

Lazarus Ide seems to properly detect F1. My application not.

Any hint?
Andrea Mauri

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


Re: [Lazarus] F1 on Linux I got 255

2016-01-29 Thread Andrea Mauri

If I press
a
I got 141 that is
C octal escaped UTF-8: \141
as reported in character map in ubuntu.

any hint to get F1 when it is pressed?

Il 29/01/2016 12:04, Andrea Mauri ha scritto:

Dear all,

lazarus 1.4.4 fpc 2.6.4
Under linux VirtualBox if I launch my application and press F1 I got key
=255 instead key = 112

procedure TfrmMainMenu.FormKeyDown(Sender: TObject; var Key: Word;
   Shift: TShiftState);
begin
   // check for F1
   if (Key = VK_F1) then
   begin
 //dosomething
   end;
end;

why?

Lazarus Ide seems to properly detect F1. My application not.

Any hint?
Andrea Mauri


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


[Lazarus] Is the TTabControl.OnDrawTab working on Windows?

2016-01-29 Thread silvioprog
Hello,

Just try the following steps:

. Open Lazarus IDE with its empty Form1;
. Put a TabControl1 in the Form1 and add one or more tabs;
. Implement the OnDrawTab event with this code:

  procedure TForm1.TabControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; AActive: Boolean);
  begin
ShowMessage('OK');
  end;

. Compile and run the project.

You can't see any message.

Now set True in the TabControl1.OwnerDraw and try the tests above again,
you can't see any message btw.

So, is the OnDrawTab event working on Windows?

PS. I did this same test on GTK and I found same problem there too.

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


Re: [Lazarus] bad luck

2016-01-29 Thread Mark Morgan Lloyd

Marc Santhoff wrote:

Good /God/ man, is that all? I opened this expecting to find that a 
member of the community was in real trouble (frankly, the sort of thing 
I was almost in over the last week).


It's enough. Costs me hour of frustrating work recreating anything,
doing nothing fruitful. Moreover I'm sitting on a time bomb, because I
really do not know, what other files may have been damaged. Last time
this happened I had some failures in other software that was detected
weeks(!) after the incident.


I'm currently using an elderly Toughbook, because something else in my 
workroom took the power out sufficiently viciously that the lights 
flickered 300m away and I've been too busy to go around everything with 
a PAT tester to find the culprit. And that's been the least of the 
problems over the last few days... curiously, some of them have been 
caused by my strident insistence that colleagues should exploit our 
central servers (which have RAID etc.) rather than relying on the aging 
hardware and OSes under their desks.



So, what know? Taken seriously I have to restore the complete system and
data from backup.

Seems I deserved some trouble because I'm not running development tools
on a dedicated machine or inside a virtual environment...

What OS are you running, and how much privilege had you given yourself? 


FreeBSD 9, simple user having sudo privilges but nothing run as root or
by sudo. The session was the same as ever - besides Lazarus.

Frankly, I think the suggestion that Lazarus /might/ have caused a 
system crash is more serious than the discovery that a system crash 
probably corrupted files.


You're right. That's why I told the story as introduction.

What I asked for is help locating and understanding Lazarus' file
handling. Some standard errors like unneccessarily holding files open
when not in use can be avoided easily.


Yes, that's a good point although there's also issues about whether the 
underlying OS, computer and attached peripherals really are syncing data 
as reliably as expected. The bottom line- of which I was reminded 
regularly during my unhappy time running OS/2- is that an OS will 
attempt to preserve the integrity of its filesystems but makes no 
guarantee about individual files, and that there's no way of determining 
that a file's been sacrificed. It's interesting to speculate on whether 
something like Lazarus could benefit from storing projects onto a 
transaction-aware database server rather than as individual files.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

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


Re: [Lazarus] bad luck

2016-01-29 Thread Marc Santhoff
On Fr, 2016-01-29 at 21:21 +, Mark Morgan Lloyd wrote: 
> Marc Santhoff wrote:
> > Hi,
> > 
> > I really had some bad luck today. When starting Lazarus it worked
> > normally first. Then I created a new unit, saved it having an
> > appropriate name, typed in a class definition without any fields or
> > methods and Hit CTRL-F9. That was the moment when my computer freezed
> > for a while, say 30 seconds, and rebooted.
> > 
> > Afterwards Lazarus' configuration was hosed, the open projects .lpi was
> > unreadable, .lpi.bak, .lpr and .lpr.bak were zero length. The file
> > system had a lot of errors.
> 
> Good /God/ man, is that all? I opened this expecting to find that a 
> member of the community was in real trouble (frankly, the sort of thing 
> I was almost in over the last week).

It's enough. Costs me hour of frustrating work recreating anything,
doing nothing fruitful. Moreover I'm sitting on a time bomb, because I
really do not know, what other files may have been damaged. Last time
this happened I had some failures in other software that was detected
weeks(!) after the incident.

So, what know? Taken seriously I have to restore the complete system and
data from backup.

Seems I deserved some trouble because I'm not running development tools
on a dedicated machine or inside a virtual environment...

> What OS are you running, and how much privilege had you given yourself? 

FreeBSD 9, simple user having sudo privilges but nothing run as root or
by sudo. The session was the same as ever - besides Lazarus.

> Frankly, I think the suggestion that Lazarus /might/ have caused a 
> system crash is more serious than the discovery that a system crash 
> probably corrupted files.

You're right. That's why I told the story as introduction.

What I asked for is help locating and understanding Lazarus' file
handling. Some standard errors like unneccessarily holding files open
when not in use can be avoided easily.

-- 
Marc Santhoff 



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


Re: [Lazarus] bad luck

2016-01-29 Thread Mattias Gaertner
On Fri, 29 Jan 2016 22:54:00 +0100
Marc Santhoff  wrote:

>[...]
> What I asked for is help locating and understanding Lazarus' file
> handling. Some standard errors like unneccessarily holding files open
> when not in use can be avoided easily.

The IDE does not hold files open.

There was a bug some days ago, that could cause the backup to erase the
file even when the file is not written, resulting in an empty file.

Mattias

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


[Lazarus] bad luck

2016-01-29 Thread Marc Santhoff
Hi,

I really had some bad luck today. When starting Lazarus it worked
normally first. Then I created a new unit, saved it having an
appropriate name, typed in a class definition without any fields or
methods and Hit CTRL-F9. That was the moment when my computer freezed
for a while, say 30 seconds, and rebooted.

Afterwards Lazarus' configuration was hosed, the open projects .lpi was
unreadable, .lpi.bak, .lpr and .lpr.bak were zero length. The file
system had a lot of errors.

I think the crash could be triggered by the fact that I have a  new,
freshly cleaned and compiled Lazarus 1.4.4 and fpc 3.0.0 because I had
to upgrade the compiler lastly for some reason. The projects object
files may be new or old, but some other dependencies will relatively
sure be old files from fpc 2.6.4.

OK, shit happens, but I wished there would be less destruciton in work
files. It is possible to care for keeping files, I know since I had to
program a system prone to spontaneous reboots to keep files under any
circumstances and in the end it worked.

I had sth. similar once when running the debugger quite often and having
to stop in the middle of the program for a source change. That made my
computer fail similarly, destroying files.

Where in Lazarus sources are the spots handling file opening and saving
when hitting CTRL-F9? Or do I need to look at the compiler, too?

And, maybe someone having enough knowledge can explain a bit aournd
these spot?

TIA,
Marc

-- 
Marc Santhoff 


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


Re: [Lazarus] bad luck

2016-01-29 Thread Mark Morgan Lloyd

Marc Santhoff wrote:

Hi,

I really had some bad luck today. When starting Lazarus it worked
normally first. Then I created a new unit, saved it having an
appropriate name, typed in a class definition without any fields or
methods and Hit CTRL-F9. That was the moment when my computer freezed
for a while, say 30 seconds, and rebooted.

Afterwards Lazarus' configuration was hosed, the open projects .lpi was
unreadable, .lpi.bak, .lpr and .lpr.bak were zero length. The file
system had a lot of errors.


Good /God/ man, is that all? I opened this expecting to find that a 
member of the community was in real trouble (frankly, the sort of thing 
I was almost in over the last week).


What OS are you running, and how much privilege had you given yourself? 
Frankly, I think the suggestion that Lazarus /might/ have caused a 
system crash is more serious than the discovery that a system crash 
probably corrupted files.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

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