Re: [Lazarus] SQLite: How to create lookup fields?

2008-12-26 Thread Luiz Americo Pereira Camara
User escreveu:
 Hi again, my TSQLite3Dataset components:

 DatasetSales with the fields: Code, Item, Amount, Price, Vendor
 DatasetItems with the fields: Code, Description

 I do not want that the lookup field to be editable.

 My new code:

 procedure TForm1.FormCreate(Sender: TObject);
 var
   TempField: TStringField;
 begin
   DatasetSales.Active := true;
   TempField := TStringField.Create(DatasetSales);
   with TempField do
 begin
   FieldName := 'New field';
   Lookup := True;
   FieldKind := fkLookup;
   KeyFields := 'Item';
   LookupDataSet := DatasetItems;
   LookupKeyFields := 'Code';
   LookupResultField := 'Description';
   DatasetSales := Self.DatasetSales;
 end;
 end;

 but nothing happen. Why?
   

1) There's a bug in your code:

DatasetSales := Self.DatasetSales;
should be
Dataset := DatasetSales;

and Active should be set after the field setup.

Another caution is to have DatasetItems opened before DatasetSales

 

2) It's not implemented in TSqlite3Dataset
I looked at the implementation and got  how it works, so i can implement 
in Sqlite3Dataset soon.

Luiz

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


Re: [Lazarus] SQLite: How to create lookup fields?

2008-12-26 Thread Alexander Klenin
On Fri, Dec 26, 2008 at 11:28, User usuarioanonimomy...@gmail.com wrote:
 Hi again, my TSQLite3Dataset components:
 My new code:

[skip]

 but nothing happen. Why?

Because, as I already pointed out:

On Thu, Dec 25, 2008 at 21:05, Alexander Klenin kle...@gmail.com wrote:
 It seems to be implemented in SQLdb (TBufDataset).
 So, in addition to the above, original poster should indeed drop 
 sqlitedataset.
 Perhaps TSQLite3Connection can be ised instead?


-- 
Alexander S. Klenin
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] console gets crazy

2008-12-26 Thread Sebastian Kraft
Hello,

after one of my applications has finished my console output gets corrupted.
Looks like this after pressing return... no carriage return is made, just one 
big line.

das...@daseeb-laptop:~/devel/cactusjukebox$ 
das...@daseeb-laptop:~/devel/cactusjukebox$ 
das...@daseeb-laptop:~/devel/cactusjukebox$ 
das...@daseeb-laptop:~/devel/cactusjukebox$ 
das...@daseeb-laptop:~/devel/cactusjukebox$

Any text I enter is not shown. 

Where do I have to look for to solve this problem?
It only occurs when I load an external library... but no seg fault or anything. 
Just a corrupted console after exit.

Any ideas where I have to look for?

Sebastia
-- 
Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] console gets crazy

2008-12-26 Thread Mattias Gaertner
On Fri, 26 Dec 2008 12:55:01 +0100
Sebastian Kraft sebastian_kr...@gmx.de wrote:

 Hello,
 
 after one of my applications has finished my console output gets
 corrupted. Looks like this after pressing return... no carriage
 return is made, just one big line.
 
 das...@daseeb-laptop:~/devel/cactusjukebox$
 das...@daseeb-laptop:~/devel/cactusjukebox$
 das...@daseeb-laptop:~/devel/cactusjukebox$
 das...@daseeb-laptop:~/devel/cactusjukebox$
 das...@daseeb-laptop:~/devel/cactusjukebox$
 
 Any text I enter is not shown. 
 
 Where do I have to look for to solve this problem?
 It only occurs when I load an external library... but no seg fault or
 anything. Just a corrupted console after exit.
 
 Any ideas where I have to look for?

Try typing 

resetenter

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


Re: [Lazarus] console gets crazy

2008-12-26 Thread Sebastian Kraft

  
  Any ideas where I have to look for?
 
 Try typing 
 
 resetenter
 

This works... Thanks!

But where does this behaviour come from? Is there a problem with my program? 
How could I solve this at the root?

Sebastian
-- 
Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] console gets crazy

2008-12-26 Thread Mattias Gaertner
On Fri, 26 Dec 2008 14:44:09 +0100
Sebastian Kraft sebastian_kr...@gmx.de wrote:

 
   
   Any ideas where I have to look for?
  
  Try typing 
  
  resetenter
  
 
 This works... Thanks!
 
 But where does this behaviour come from? Is there a problem with my
 program? How could I solve this at the root?

Some shells reacts to special characters (#32). Check if you are
writing special characters.

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


[Lazarus] MaskEdit: question on how it should behave

2008-12-26 Thread Bart
Hi,

I'm currently working on the MaskEdit unit, which is ATM not totally
Delphi compatible  ;)
Since I only have an ancient Delphi (D3) (on ancient hardware, so I
cannnot even run newer versions) I have some questions on the
behaviour of MaskEdit in current delphi versions.

Question 1:

If I set the text of a MaskEdit to some value that does not match the
mask (e.g. EditMask = '' and then MaskEdit.Text := 'ABCD'), in D3
no exception is raised and the text in the control is set. Is this
still the case in current Delphi's?
(In Lazarus ATM an Exception is raised if you try to do that)

Question 2:
What does an exclamationmark (!) in a mask actually do. The helptext
says it removes leading spaces from the data (what data?) and if no !
is in the mask it removes trailing spaces. In real live I see no
effect on either MaskEdit.Text or MaskEdit.EditText at all.

Question 3:
In the EditMask you can specify if the mask will be saved as pasrt of
the data (again: what data?). For instance, if your EditMask is
'000;0;_' then maskdata is not saved (the first 0 after the colon ( ;
) sets this value).
I cannot really figure out what it does. I see noe effect n Text or
EditText at all.

Regarding questions 2 and 3: I could, of course, try and understand
the VCL code, but that would probably increase the risk of writing
code that is almost identical to the copyrighted VCL code.

Thanks for now.

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


Re: [Lazarus] MaskEdit: question on how it should behave

2008-12-26 Thread Alexander Klenin
On Sat, Dec 27, 2008 at 10:07, Bart bartjun...@gmail.com wrote:
 Question 1:

 If I set the text of a MaskEdit to some value that does not match the
 mask (e.g. EditMask = '' and then MaskEdit.Text := 'ABCD'), in D3
 no exception is raised and the text in the control is set. Is this
 still the case in current Delphi's?
 (In Lazarus ATM an Exception is raised if you try to do that)

I am not sure how modern Delphi behaves, but I'd say that Lazarus
way is correct here -- this is clearly a programmes's error.
OTOH, I think it would be useful to provide a separate function
like 'TrySetText' which whould return false instead if saising an exception.

 Question 3:
 In the EditMask you can specify if the mask will be saved as pasrt of
 the data (again: what data?). For instance, if your EditMask is
 '000;0;_' then maskdata is not saved (the first 0 after the colon ( ;
 ) sets this value).
 I cannot really figure out what it does. I see noe effect n Text or
 EditText at all.

If you mask includes non-special characters, those are displayed in
the editor as-is,
e.g. if mask is 000-00-00 and the user enters 1234567, the editor
would contain
123-45-67. Depending on the value of the flag, the actual Text property
will contain either 1234567 or 123-45-67.


-- 
Alexander S. Klenin
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus