[Lazarus] Gtk2 focus problem with shortcut keys

2008-10-13 Thread Brad Campbell
G'day all,

Here is another one.

Create a new form and place a TMainMenu, TEdit and TButton on the form.

Create a File/Quit menu and assign the quit menu the shortcut ctrl+W.

Hook it up. (This is the only piece of code in the project really)

procedure TForm1.MenuQuitClick(Sender: TObject);
begin
   Close;
end;

Now, when the TEdit has focus, the shortcut does not work. The only way to get 
it to work is click 
the button (to focus it). Now you can close the form with ctrl-W.

This seems to be prevalent with any component that takes a keyboard input (I 
noticed it with 
TSynEdit initially).

v0.9.27 r16943M i386-linux-gtk 2 (beta)

Free Pascal Compiler version 2.2.3 [2008/10/08] for i386
Copyright (c) 1993-2008 by Florian Klaempfl


unit Unit1;

{$mode objfpc}{$H+}

interface

uses
   Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
   SynEdit, Menus, StdCtrls;

type

   { TForm1 }

   TForm1 = class(TForm)
 Button1: TButton;
 Edit1: TEdit;
 MainMenu1: TMainMenu;
 MenuFile: TMenuItem;
 MenuQuit: TMenuItem;
 procedure FormCreate(Sender: TObject);
 procedure MenuQuitClick(Sender: TObject);
   private
 { private declarations }
   public
 { public declarations }
   end;

var
   Form1: TForm1;

implementation

{ TForm1 }

procedure TForm1.MenuQuitClick(Sender: TObject);
begin
   Close;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

end;

initialization
   {$I unit1.lrs}

end.

Regards,
Brad
-- 
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Carbon: UTF8 and few component showing rect characters

2008-10-13 Thread Felipe Monteiro de Carvalho
On Mon, Oct 13, 2008 at 6:56 AM, EarMaster - Bent Olsen
[EMAIL PROTECTED] wrote:
 The right characters in a text isn't being displayed in like TLabel (you'll
 get rectangle characters), but the same text is right in a TEdit component.

Rectagle characters indicates that the font does not support the
chracter. Try using another font.

-- 
Felipe Monteiro de Carvalho
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Carbon: UTF8 and few component showing rect characters

2008-10-13 Thread EarMaster - Bent Olsen
 Rectagle characters indicates that the font does not support the
 chracter. Try using another font.

Thanks, and I see, but it's strange thou, because the components was set
with the same font at first (Geneva), and only TEdit adapted.

I found a font like STKaiti which displays a Japanese text just fine in
TLabel, but it differs a little bit from the TEdit font - I just noticed
that TLabel and TEdit differs in font type, also if you display characters
like 1 2 3 4, even if you set these to the same font name and size. I then
found out that you can only set font size and style for TEdit, but it
completely ignores the font name, which changes just fine for TLabel.

How does TEdit find which font to use, or which font does a component like
TEdit use, which then I can apply to a TLabel control?

Thanks again,
Normann

 Felipe Monteiro de Carvalho

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


[Lazarus] WinCE Printing (again)

2008-10-13 Thread cc_
Hello List,

Until now I have thought WinCE  had  no solution for printing at all. I have 
just realised that WinCE  actually has built in support for some memeber of the 
PCL language family. When asking about this subject earlier here in the mailing 
list noone seemed to know about it, so I thought this could be a useful peace 
of information for the developers of LazReport.  

It would be great to have some indication if/when Lazreport will support this 
in the forseeable future.


Regards, 
Leslie___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Carbon: UTF8 and few component showing rect characters

2008-10-13 Thread Felipe Monteiro de Carvalho
On Mon, Oct 13, 2008 at 10:15 AM, EarMaster - Bent Olsen
[EMAIL PROTECTED] wrote:
 How does TEdit find which font to use, or which font does a component like
 TEdit use, which then I can apply to a TLabel control?

TEdit is a native Windows control, and by default Windows will choose
the adequate font. The font differs between different Windows
versions. The default font under XP is Tahoma, as explained here:

http://wiki.lazarus.freepascal.org/LCL_Unicode_Support#East_Asian_languages_on_Windows

TLabel is not a native control. It is drawn by LCL, so LCL chooses the
font by default. I don't know which font LCL uses by default for
TLabel.

-- 
Felipe Monteiro de Carvalho
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Carbon: UTF8 and few component showing rect characters

2008-10-13 Thread EarMaster - Bent Olsen
 TEdit is a native Windows control, and by default Windows will choose
 the adequate font. The font differs between different Windows
 versions. The default font under XP is Tahoma, as explained here:
 
 http://wiki.lazarus.freepascal.org/LCL_Unicode_Support#East_Asian_langu
 ages_on_Windows

I know, but this does not apply to Carbon on Mac, so I'll try to find a way
to obtain the default font name through an API call from a Mac installation,
and use this information to apply the same font name to label components.

Thanks,
Normann

 TLabel is not a native control. It is drawn by LCL, so LCL chooses the
 font by default. I don't know which font LCL uses by default for
 TLabel.



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


Re: [Lazarus] infinite loop due no OnChange event firing

2008-10-13 Thread Michael Van Canneyt


On Mon, 13 Oct 2008, Graeme Geldenhuys wrote:

 Hi,
 
 In tiOPF with LCL widgetset we hit a little snag. We react to the
 OnChange event of a TEdit. In GTK1 we have no issues. In GTK2 we get a
 core dump as soon as the text has changed (first key being pressed).
 Here is a discussion about the issue between Michael and myself.
 Michael thinks it's normal, I think it's a bug in LCL.

Small correction: I don't think it is 'normal', but I do think one 
never should rely on this behaviour :-)

At the very least, all widget sets should react in the same manner:
if the TEdit.OnChange event is not fired in GTK 1, it should not fire
in Windows or GTK 2 or Mac either.

And the latter is demonstratably not the case now; So this should 
definitely be fixed.

Michael.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] SQLite: Several foreign keys

2008-10-13 Thread Usuario AnĂ³nimo
If I want to create a simple master/detail relationship of one-to-many, it
is easy:

Tables and fields:

Contact: [u]Code[/u], Name -- Master table
Phone: [u]Number[/u], Contact (Contact is a foreign key) -- Detail table

Contact TDataSource properties:
 - DataSet: ContactDataset
 - Name: ContactDataSource

Contact TSqlite3Dataset properties:
 - Name: ContactDataset
 - TableName: Contact

Phone TDataSource properties:
 - DataSet: PhoneDataset
 - Name: PhoneDataSource

Contact TSqlite3Dataset properties:
 - Name: PhoneDataset
 - TableName: Phone
 - IndexFieldNames: Contact
 - MasterFields: Code
 - MasterSource: ContactDataSource

But, if I want to create a master/detail relationship of one-to-many with
several foreign keys, how I do it?

For example I want to create this relationship:

Contact: [u]Code[/u], Name -- Master table
Company: [u]Code[/u], Name -- Master table
Phone: [u]Number[/u], Contact, Company (Contact and Company are foreigns
keys) -- Detail table

How I do it?

Best regards.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] infinite loop due no OnChange event firing

2008-10-13 Thread Michael Van Canneyt


On Mon, 13 Oct 2008, Graeme Geldenhuys wrote:

 On Mon, Oct 13, 2008 at 11:05 AM, Michael Van Canneyt
 [EMAIL PROTECTED] wrote:
 
  Small correction: I don't think it is 'normal', but I do think one
  never should rely on this behaviour :-)
 
 My apologies... :-)
 
 
  At the very least, all widget sets should react in the same manner:
  if the TEdit.OnChange event is not fired in GTK 1, it should not fire
  in Windows or GTK 2 or Mac either.
 
  And the latter is demonstratably not the case now; So this should
  definitely be fixed.
 
 Agreed!
 
 What is weird is that for the same of being complete, I created three
 test applications. One TEdit and one TButton.  The edit has the text
 'Hello' set at design time.  The Button's OnClick will assign the
 value 'Hello' to TEdit.  Edit1.OnChange simply does a writeln to the
 console to show it has fired.  Button1.OnClick does a writeln() before
 and after the call to Edit1.  This application was created for fpGUI,
 LCL-GTK1 and LCL-GTK2.  I can't reproduce the error we experienced in
 tiOPF+LCL applications. Edit1.OnChange doesn't seem to fire now... :-(
  But it does in tiOPF+LCL apps. :-/

IMHO because you should change the exit.text in the edit.onchange event,
only then the effect will occur.

Michael.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] infinite loop due no OnChange event firing

2008-10-13 Thread Graeme Geldenhuys
Hi,

In tiOPF with LCL widgetset we hit a little snag. We react to the
OnChange event of a TEdit. In GTK1 we have no issues. In GTK2 we get a
core dump as soon as the text has changed (first key being pressed).
Here is a discussion about the issue between Michael and myself.
Michael thinks it's normal, I think it's a bug in LCL.

-[ forward reply from myself ]--
Michael van Canneyt wrote:
 We looked into this, and it is the mediator design flaw which I told
 you about: you rely on the fact that setting the text of an edit to
 the same text will not trigger the OnChange event. Something which I
 thought you should not rely on.

I still believe this is a bug in the GTK2 (or LCL-GTK2 widgetset).
OnChange tells me the value has changed. Setting the Text to the same
Text value doesn't change the value, so there is no need to fire the
OnChange event.

It is quite normal to have the following in a setter method where
FValue is the internal storage field and AValue is the new parameter
value passed in.

if FValue = AValue then
  Exit;
{ if we got here then something has really changed...}
FValue := AValue.
DoOnChange;// or whatever else...

-[ end ]---

Like I explained above... Surely there is no need to fire a OnChange
event if the TEdit.Text is set to the exact same Value.

eg:

 Edit1.Text currently has the value:  'Hello'.

No I do the following...

  Edit1.Text := 'Hello';

I'm assigning the same value to Edit1.Text again... nothing changed,
so why must OnChange file?  See my example code which is pretty normal
code for any setter method and even auto generated by Lazarus IDE.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Carbon: UTF8 and few component showing rect characters

2008-10-13 Thread mitya boyarintsev
Apple developers mailing lists (lists.apple.com) are also rich in discussion
of such problems. It's good practise to search aboutr carbon problems there:

i.e.: this thread, is cocoa based application, but still might be useful:
http://lists.apple.com/archives/java-dev/2002/Nov/msg00072.html I'm pretty
sure, that there're some discussions about carbon too.

may be you can check if font supports some unicode features:
http://developer.apple.com/documentation/Carbon/Conceptual/ATSUI_Concepts/atsui_app_features/chapter_9_section_1.html
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Gtk2 focus problem with shortcut keys

2008-10-13 Thread Bart
Actually, you might post a note in this bugreport, nobody has confirmed this
bug since I posted it.
Once confirmed, changes may improve that the bug gets assigned to some
developer.

I tried to see where things go wrong, but I failed hopelessly ;-)

Bart
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Gtk2 focus problem with shortcut keys

2008-10-13 Thread Bart
On 10/13/08, Brad Campbell [EMAIL PROTECTED] wrote:

 G'day all,
 [on non working menu-shortcut is TEdit has focus]


 I reported this as bug
0007306http://bugs.freepascal.org/view.php?id=7306in 2006...

Bart
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Gtk2 focus problem with shortcut keys

2008-10-13 Thread Brad Campbell
Bart wrote:
 Actually, you might post a note in this bugreport, nobody has confirmed 
 this bug since I posted it.
 Once confirmed, changes may improve that the bug gets assigned to some 
 developer.
 
 I tried to see where things go wrong, but I failed hopelessly ;-)

I've added a note to confirm the bug.

Regards,
Brad
-- 
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus