Re: [Lazarus] Are multiple critical sections allowed in form or data module?

2011-10-08 Thread Mattias Gaertner
On Sun, 9 Oct 2011 00:22:10 +0100
Frank Church  wrote:

> Are multiple critical sections allowed in form or data module?
> 
> e.g. I have different datasets each with its own connection and queries that
> threads need to lookup data from.
> 
> Is it acceptable to have additional TCriticalSections on the form?

Yes.
I hope you are aware that all code accessing the LCL must run in the
main thread.

Mattias


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


[Lazarus] Are multiple critical sections allowed in form or data module?

2011-10-08 Thread Frank Church
Are multiple critical sections allowed in form or data module?

e.g. I have different datasets each with its own connection and queries that
threads need to lookup data from.

Is it acceptable to have additional TCriticalSections on the form?

-- 
Frank Church

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


Re: [Lazarus] Platform dependent modifier for common shortcut-keys?

2011-10-08 Thread Hans-Peter Diettrich

Bart schrieb:


This is a chunk form a proposed patch for TMaskEdit:

 procedure TCustomMaskEdit.KeyDown(var Key: Word; Shift: TShiftState);
+const
+  ssModifier = {$if defined(darwin) or defined(macos)} ssMeta {$else}
ssCtrl {$endif};
 begin
   Inherited KeyDown(Key, Shift);
   // Not masked -> old procedure
@@ -1662,7 +1664,7 @@
   begin//Cut
 CutToClipBoard;
   end
-  else if (Shift = [ssCtrl]) then
+  else if (Shift = [ssModifier]) then
   begin//Clear
 DeleteSelected;
   end

This is the way I would see it being helpful for cross platform code
for built-in key shortcuts.


You can do it this way, ignoring any platform standards. But this is not 
what I expect from a cross-platform library or component.




StandardActions then could benefit from such a ssModifier constant as well.

Another approach might be to have a widgetset function like:

function KeyCombo_IsCut(const Key: Word; const Shift: TShiftState): Boolean

or something like:

type
  TCommonShortCut = (tcsUnknown,tcsCut, tcsPaste, tcsCopy, tcsBof, tcsEof);

function KeyComboToCommonShortcut(const Key: Word; const Shift:
TShiftState): TCommonShortCut;
begin
  //default to tcsUnKnown;
  Result := tcsUnKnown;
  ...
end;


This comes much closer to my expectations :-)

DoDi


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


Re: [Lazarus] Synchronize in Threads not working correctly on Gtk2 on Windows 32?

2011-10-08 Thread Bernd
2011/9/19 Michael Schnell :

> I recently verified that TThread.Synchronize does work (in my testing
> program) in the current svn version of Lazarus. It did not work in some
> older versions.

IIRC there was a problem with older GTK2 versions (only really old
versions, Ubuntu Hardy and older) and TThread.Sychronize not working.
I can remember I was forced to work around this by implementing my own
synchronizing mechanism with PostMessage() and RTLEventWaitFor()
(sounds more complicated than it actually was, only a few lines of
code).

There must be a thread about it here (but I can't remember its title)
and also I believe there was a demo program somewhere that
demonstrated this problem.

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


Re: [Lazarus] Platform dependent modifier for common shortcut-keys?

2011-10-08 Thread Flávio Etrusco
> Another approach might be to have a widgetset function like:
>
> function KeyCombo_IsCut(const Key: Word; const Shift: TShiftState): Boolean
>
> or something like:
>
> type
>  TCommonShortCut = (tcsUnknown,tcsCut, tcsPaste, tcsCopy, tcsBof, tcsEof);
>
> function KeyComboToCommonShortcut(const Key: Word; const Shift:
> TShiftState): TCommonShortCut;
> begin
>  //default to tcsUnKnown;
>  Result := tcsUnKnown;
>  ...
> end;
>
> Bart

This is a very good idea.
Check/Test/IsStandardShortCut? ;-)

-Flávio

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


Re: [Lazarus] Platform dependent modifier for common shortcut-keys?

2011-10-08 Thread Bart
On 10/7/11, Flávio Etrusco  wrote:

> That's my gut feeling too. Do you think implementing the missing
> TStandardActions and handling their default ShortCut accordingly would
> suffice?

I do not think solving this _only_ in TStandardActions is the way to go.
I specifically would use something like ssModifier (=ssCtrl, or
=ssMeta) in LCL components (e.g. TMaskEdit which by design handles all
key input by itself, and there are other LCL examples like SynEdit,
TreeView (IIRC) and DBGrid).

This is a chunk form a proposed patch for TMaskEdit:

 procedure TCustomMaskEdit.KeyDown(var Key: Word; Shift: TShiftState);
+const
+  ssModifier = {$if defined(darwin) or defined(macos)} ssMeta {$else}
ssCtrl {$endif};
 begin
   Inherited KeyDown(Key, Shift);
   // Not masked -> old procedure
@@ -1662,7 +1664,7 @@
   begin//Cut
 CutToClipBoard;
   end
-  else if (Shift = [ssCtrl]) then
+  else if (Shift = [ssModifier]) then
   begin//Clear
 DeleteSelected;
   end

This is the way I would see it being helpful for cross platform code
for built-in key shortcuts.

StandardActions then could benefit from such a ssModifier constant as well.

Another approach might be to have a widgetset function like:

function KeyCombo_IsCut(const Key: Word; const Shift: TShiftState): Boolean

or something like:

type
  TCommonShortCut = (tcsUnknown,tcsCut, tcsPaste, tcsCopy, tcsBof, tcsEof);

function KeyComboToCommonShortcut(const Key: Word; const Shift:
TShiftState): TCommonShortCut;
begin
  //default to tcsUnKnown;
  Result := tcsUnKnown;
  ...
end;

Bart

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


Re: [Lazarus] Short cut key for Code templates names

2011-10-08 Thread Frank Church
On 8 October 2011 11:59, Mattias Gaertner  wrote:

> On Sat, 8 Oct 2011 11:28:11 +0100
> Frank Church  wrote:
>
> > Is there a short cut for bringing up the abbreviations used for your code
> > templates, in case you can't remember all of them?[?]
>
> Ctrl+j
>
>
D'OH



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



-- 
Frank Church

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


Re: [Lazarus] Short cut key for Code templates names

2011-10-08 Thread Mattias Gaertner
On Sat, 8 Oct 2011 11:28:11 +0100
Frank Church  wrote:

> Is there a short cut for bringing up the abbreviations used for your code
> templates, in case you can't remember all of them?[?]

Ctrl+j

Mattias

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


[Lazarus] Short cut key for Code templates names

2011-10-08 Thread Frank Church
Is there a short cut for bringing up the abbreviations used for your code
templates, in case you can't remember all of them?[?]



-- 
Frank Church

===
http://devblog.brahmancreations.com
<<32B.gif>>--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Can't find package

2011-10-08 Thread Mattias Gaertner
On Sat, 08 Oct 2011 10:08:54 +0200
"Santiago A."  wrote:

> Hello:
> 
> I had installed in my ubuntu 9.10 Lazarus 0.9.28. I finally decided to
> upgrade it to 0.9.30.
> I removed 0.9.28 to start from scratch, downloaded the deb packages
> fpc-2.42 and lazarus-0.9.30 (in big tarballS). 
> 
> After several issues with dependences, I managed to install it. Besides, I 
> have removed the $home/.lazarus directory
> 
> But now I try to add the package sqlite3laz from the IDE, when I rebuild
> it and I get "Can't find unit sqlite3laz". But sqlite3laz.pas is in 
> /usr/lib/lazarus/0.9.30/components/sqlite.
> 
> I tried to compile the package from menu package/open loaded package, but I 
> get "you don't have permission to write 
> on /usr/lib/lazarus directory" or similar. So I have run Lazarus as root and 
> compiled and tried again, now it has 
> compiled the package and generated the following files:
> 
> /usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlite3laz.o
> /usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlite3laz.compiled
> /usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlitecomponenteditor.ppu
> /usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlite3laz.ppu
> /usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlitecomponenteditor.o
> 
> But when I build lazarus, I get the same result: "Can't find unit sqlite3laz"
> any path or macro missing? Any Idea or clue about what's happening?

Maybe you have some old ppu files somewhere.
Compile with fpc flags -vut to find out.

Mattias

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


[Lazarus] Can't find package

2011-10-08 Thread Santiago A.
Hello:

I had installed in my ubuntu 9.10 Lazarus 0.9.28. I finally decided to
upgrade it to 0.9.30.
I removed 0.9.28 to start from scratch, downloaded the deb packages
fpc-2.42 and lazarus-0.9.30 (in big tarballS). 

After several issues with dependences, I managed to install it. Besides, I have 
removed the $home/.lazarus directory

But now I try to add the package sqlite3laz from the IDE, when I rebuild
it and I get "Can't find unit sqlite3laz". But sqlite3laz.pas is in 
/usr/lib/lazarus/0.9.30/components/sqlite.

I tried to compile the package from menu package/open loaded package, but I get 
"you don't have permission to write 
on /usr/lib/lazarus directory" or similar. So I have run Lazarus as root and 
compiled and tried again, now it has 
compiled the package and generated the following files:

/usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlite3laz.o
/usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlite3laz.compiled
/usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlitecomponenteditor.ppu
/usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlite3laz.ppu
/usr/lib/azarus/components/sqlite/lib/i386-linux/gtk2/sqlitecomponenteditor.o

But when I build lazarus, I get the same result: "Can't find unit sqlite3laz"
any path or macro missing? Any Idea or clue about what's happening?

Regards
Santiago A.
s...@ciberpiula.net







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


Re: [Lazarus] Size adjustments in TControl.DoDock

2011-10-08 Thread Hans-Peter Diettrich

Hans-Peter Diettrich schrieb:
I don't understand why DoDock ignores the given rectangle, that was 
shown while the control has been dragged.


Clarification:

TControl.DoDock should *never* change ARect itself (Delphi compatible).

Eventual adjustments can be made in an *overridden* implementation (see 
TCustomForm.DoDock), which calls inherited to do whatever is required - 
but not more.


Then entire block
  if NewDockSite<>nil then begin
  ...
should be removed.

DoDi


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