Re: [lazarus] DataBase Queries

2008-02-05 Thread Roberto Padovani
2008/2/5, Michael Van Canneyt [EMAIL PROTECTED]:


 On Mon, 4 Feb 2008, el stamatakos wrote:

 
  Hi,
   I am working with a database and I am doing the following
 
  tFile:string;
 
  tFileName:=mainForm.SQLQuery1.FieldValues['tFileName'];

 You should never use FieldValues, this is a horrible construct which Delphi
 introduced for Visual Basic  compatibility.

 You should use
   tFileName:=mainForm.SQLQuery1.FieldByName('TFileName').AsString;
 instead.


exactly...and I seem to remember that there was a bug in the reader
method of the FieldValues property which prevented it to work.

R#

.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[Lazarus] Wrong error message ?

2008-01-26 Thread Roberto Padovani
Hi,

I coded (too quickly) the following lines:

sqlite.SQL := 'SELECT COUNT(id) FROM utenti WHERE id = '+id_utente+'
AND password='+editOldPsw.Text+'';

and a few lines later:

sqlite.SQL:= 'UPDATE utenti SET password='+editNewPsw.Text+',
scadenza_psw=date(now,+90 day) WHERE id = '+id_utente;

The variable id_utente is an integer which means that I forgot to use IntToStr.
However I get the errors (relating to these two lines) in the
attachment...shouldn't they be the same ? The first one seems to be
written the other way round.

Cheers and beers,

  R#
attachment: error1.png

Re: [lazarus] Simulate ALT+KEY to open a menu

2008-01-16 Thread Roberto Padovani
Hi,

if you go to the form events in design mode, then you should see an
OnKeyDown event. Click on the ... button and the event handler will
be defined as the standard FormKeyDown method.

there's a mistake in the code I suggested to you yesterday: key is
declared as a var parameter so the correct code is:

var k: word;
begin
  ...
  k:= 65;   { this is ASCII character  A}
  self.FormKeyDown(self,k,[ssAlt]);
  ...
end;

cheers,

  R#



2008/1/16, Fabio Dell'Aria [EMAIL PROTECTED]:
 Hi,

 2008/1/15, Roberto Padovani [EMAIL PROTECTED]:
  why don't you call the method FormKeyDown yourself?
  ...
  begin
  ...
self.FormKeyDown(self, 65,[ssAlt]);
  
  end;

 I do not find this method.

  R#
 
 
  2008/1/15, Fabio Dell'Aria [EMAIL PROTECTED]:
   Hi,
  
   2008/1/15, Lee Jenkins [EMAIL PROTECTED] :
Fabio Dell'Aria wrote:
 Hi to all,

 how I can simulate the ALT+E key-press command on a specified
 TForm
 for open its Edit menu?

   
Fabio, can you try:
   
1. Set TMyForm.KeyPreview := true
   
2. OnKeyDown Event Code:
   
procedure TMyForm.FormKeyDown ( Sender: TObject; var Key: Word;
   Shift: TShiftState) ;
begin
   if (ssAlt in Shift) and (key = 65) then
 AMenuItem.Click;
   
   // or...
   // if (ssAlt in Shift) and (lowercase(Chr(key)) = 'e') then
end;
   
I don't do that kind of key capture much so there may be a better way
 to
   test
for upper or lowercase 'e';
  
   Not always this keys open a menu, other times do others.
  
   So I cannot call directly the MenuItem.Click method.
  
   I need to simply simulate a keypress. How I can do this?
  
--
Warm Regards,
   
Lee
   
The only thing that kept me out college...was high school.
   
   
  
 _
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at
   http://www.lazarus.freepascal.org/mailarchives
   
  
  
  
   --
   Best regards...
  
   Fabio Dell'Aria.
 
 
 _
   To unsubscribe: mail [EMAIL PROTECTED] with
  unsubscribe as the Subject
 archives at
 http://www.lazarus.freepascal.org/mailarchives
 



 --
 Best regards...

 Fabio Dell'Aria.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Solution to the BIG compiled file issue!

2008-01-15 Thread Roberto Padovani
I think to be the typical example of the average user, so I'll give my
opinion as well.

- I don't care about the download size, so I am fine with downloading
the full debugging objects files
- I don't care about hard disk size (being anyone not too much for
nowadays): the installer could run the object script at the end and it
could create the non-debugging-LCL objects tree
- I would love the option to build against the debugging-LCL objects
or the non-debugging-LCL ones
- I would really like to see some kind of clean up of the
compiler/linker options, in order to have easier access to the strip
tool

ok...I should have written all of this to Santa Claus by XmasI'm
always late :-)

R#


2008/1/15, Vincent Snijders [EMAIL PROTECTED]:
 Fabio Dell'Aria schreef:
or a Project option (as in
Delphi for the Use Debug DCUs compiler option)!
   
 
  How is this different from using the correct compiler options?
 
 
  Using only the -Xs compiler option remove all the debug info and is
  impossible debug my project, my option continue to can debug the project
  only hiding the LCL sources. ;)
 

 I see. Thanks.

 Vincent

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives


_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Simulate ALT+KEY to open a menu

2008-01-15 Thread Roberto Padovani
why don't you call the method FormKeyDown yourself?
...
begin
...
  self.FormKeyDown(self, 65,[ssAlt]);

end;

R#


2008/1/15, Fabio Dell'Aria [EMAIL PROTECTED]:
 Hi,

 2008/1/15, Lee Jenkins [EMAIL PROTECTED]:
  Fabio Dell'Aria wrote:
   Hi to all,
  
   how I can simulate the ALT+E key-press command on a specified TForm
   for open its Edit menu?
  
 
  Fabio, can you try:
 
  1. Set TMyForm.KeyPreview := true
 
  2. OnKeyDown Event Code:
 
  procedure TMyForm.FormKeyDown( Sender: TObject; var Key: Word;
 Shift: TShiftState) ;
  begin
 if (ssAlt in Shift) and (key = 65) then
   AMenuItem.Click;
 
 // or...
 // if (ssAlt in Shift) and (lowercase(Chr(key)) = 'e') then
  end;
 
  I don't do that kind of key capture much so there may be a better way to
 test
  for upper or lowercase 'e';

 Not always this keys open a menu, other times do others.

 So I cannot call directly the MenuItem.Click method.

 I need to simply simulate a keypress. How I can do this?

  --
  Warm Regards,
 
  Lee
 
  The only thing that kept me out college...was high school.
 
 
 _
   To unsubscribe: mail [EMAIL PROTECTED] with
  unsubscribe as the Subject
 archives at
 http://www.lazarus.freepascal.org/mailarchives
 



 --
 Best regards...

 Fabio Dell'Aria.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] New icon for lazarus

2007-12-21 Thread Roberto Padovani
Hi,

this morning I felt like graphing...
the print on the ground is a nice idea, so I tried to solve the
problem of contrast and resolution in windows detail view, i.e.
16x16 icons.
Contrast is solved by using the color of a cheetah instead of grey as
a basic color + high-lining (English??) the prints with black. To make
it more modern I added a point of light effect on the main finger
print.
From 48x48 to 32x32 everything scales well; in the 16x16 there is a
resolution problem: scaling is too confusing, so I basically re-drew
the same icon but changing the smaller prints.

So, here's my result, anyone likes it ?

cheers,

  Roberto



2007/12/21, Marc Weustink [EMAIL PROTECTED]:
 Vincent Snijders wrote:
  Marc Weustink schreef:
  wile64 wrote:
  I propose a new icon for lazarus, It can be used for whatever you
  want :)
 
  huh... this is a grey dot.
 
  Any meaning/thoughts ?
 
 
  I thought it was a pawn print of a cheetah. But it is not very clear,
  you have to 'know' it to see it.

 I found out too... default the smallest is shown here, after opening and
 browsing the icon images I saw the larger ones.

 Marc


 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives

attachment: lazarus_icon_roberto.ico

Re: [lazarus] New icon for lazarus

2007-12-21 Thread Roberto Padovani
yeah, the 16x16 is too dark. In my 16x16 icon I made the print a few
pixels thinner and I used a dark brown instead of black.
On the other side, your icon_yellow 48x48 is much better (of course,
you're graphically serious!) both in the smaller prints (mine were
actually too greyish) and in the light, which is poured over in a
better way.
So, what about mixing it all ? If you make your 16x16 with thinner
brown prints, so that it doesn't look so dark, it will be perfect!

In the end we'll have one nice icon more, but should we really change
the lazarus cheetah icon? Would it be so crazy to use the cheetah face
in 48x48 and 32x32, but using the 16x16 cheetah print.

R#

2007/12/21, Marc Weustink [EMAIL PROTECTED]:
 wile64 wrote:
 
 
  2007/12/21, Roberto Padovani [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED]:
 
  Hi,
 
  this morning I felt like graphing...
  the print on the ground is a nice idea, so I tried to solve the
  problem of contrast and resolution in windows detail view, i.e.
  16x16 icons.
  Contrast is solved by using the color of a cheetah instead of grey as
  a basic color + high-lining (English??) the prints with black. To make
  it more modern I added a point of light effect on the main finger
  print.
   From 48x48 to 32x32 everything scales well; in the 16x16 there is a
  resolution problem: scaling is too confusing, so I basically re-drew
  the same icon but changing the smaller prints.
 
  So, here's my result, anyone likes it ?
 
  cheers,
 
Roberto
 
 
  I can redo any color :)

 I think the small one is to black, the small one form roberto I liked more.

 Marc


 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives


_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] libview enhancement

2007-12-16 Thread Roberto Padovani
thanks to you! let me know when the new release is ready.
Btw, when I don't feel like working I'm having a look at how to make
it work under *nix (which will fit to my beloved Mac, as well)

R#

2007/12/16, Felipe Monteiro de Carvalho [EMAIL PROTECTED]:
 Hi Roberto Padovani,

 I will do a new libview release (0.2) with some of your code. I also
 added your name to the authors list.

 thank you very much,
 --
 Felipe Monteiro de Carvalho

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives


_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] key mappings (lowest priority ever!)

2007-12-16 Thread Roberto Padovani
Hi,

I just wanted to change some key mappings in the editor options and
everything worked just fine, except that I added a shortcut to set a
free bookmark (I liked Ctrl-B) and it doesn't work. Any other
shortcut for this doesn't work.
I couldn't find anything on the mantis, so is there anyone using this
shortcut out there ? am I missing something ?

R#

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] vote for bdd related component icon

2007-12-11 Thread Roberto Padovani
delphi's choice tdatasource.png has never been familiar to me: this
might be the right time to make a different choice.
Since it is important to distinguish a dataset to a datasource, so I would use:

tdatasource1.png as a base for a generic dataset, which is then
specialized with 3 letters on it: SQL if it is a query, TDF, MEM
and so on

tdatasource2.png for datasource

and I would leave the bitmap of a grid only for grids.

my .02

R#

2007/12/11, wile64 [EMAIL PROTECTED]:
 Hi all,

 Please vote for the image of your choice
 Thanks,

 --
 Laurent.

 My Components: http://wiki.lazarus.freepascal.org/Wile64
 French Forum : http://lazforum-fr.tuxfamily.org/index.php



-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] splash image: share your ideas

2007-12-11 Thread Roberto Padovani
the actual spalsh is beautiful, but I agree on the fact that it's too
abstract: it takes time to look at it completely, in every detail, and
it takes even more time to understand it
IMHO, it is suitable for the home page, where you can stare it, but
not for a spash which disappears in a moment.
a more concise splash would more appropriate: the Bee's one can be a step.

And what's more, I came to lazarus attracted by write once, compile
everywhere and opensource

R#

2007/12/11, Andrey Gusev [EMAIL PROTECTED]:
 * Bee [EMAIL PROTECTED] [Tue, 11 Dec 2007 16:26:26 +0700]:
  Continuing Laurent's work, I can manage my graphics designer to make a
  new Lazarus splash image. The image at
 http://i5.tinypic.com/89gmjq1.png
  only shows the current basic ideas.
 
  But we need more input about other ideas such as color, philosophy,
  concepts, slogans, mottoes, etc.

 Maybe somewhat like Lazarus splash competition, that's about ideas or
 designed images,
 would be conducted. 0.9.26 is enough near to 1.0, so the time.

 Current Lazarus splash seems to me is too abstract, and not very stylish
 (so to say),
 i'm not professional designer, but i work with POV-Ray, enough time.

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives


_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] libview enhancement

2007-12-10 Thread Roberto Padovani
the hard part was done by Felipe's in libview 0.1I only added the
output generation.
Felipe and Peter Below wrote the nice piece which lists the exported functions.

The core unit, dlltools.pas, is the one that knows about the dll
structure: one should write a similar unit for reading from shared
objects filedefinetely out of my reach, I honestly don't know
anything about the internals of .so

On the other hand, for the *nix platform, one may try to wrap around
the nm utility which is part of binutils.

R#

2007/12/10, Al Boldi [EMAIL PROTECTED]:
 Roberto Padovani wrote:
  This helps me because I had some dll with many exported functions and
  with both call type.
  I hope someone will find it useful, as well.

 Neat, but this only works on windows.

 Can you make it cross-platform?


 Thanks!

 --
 Al

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives



-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] MySQL problems compiling in RedHat 4.5

2007-12-10 Thread Roberto Padovani
try creating a symbolic link to the library in your project folder.

R#


2007/12/11, Christian U. [EMAIL PROTECTED]:
 Thers nothing wrong with Lazarus and no Patch needed. libmysqlclient.so
 cant be found on your system thats all, like the error message say.
 Maybe you havend installed the mysql client libs or thers no symlink to
 the libs.

   Hi,
   I created a Lazarus project with MySQL database support. I used Red
  Hat 4.5 and compiled fine. Now I use 4.5 Red Hat and it gives me an
  error Project raised exception EInOutError with message Can not load
  MySQL library libmysqlclient.so'. Please check your installation.
  Anybody have any idea what is wrong and if there is a patch for this.
  Thanks
 
  Lefti

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives



-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] SQLite 3 datetime and timestamp

2007-12-03 Thread Roberto Padovani
Hi Luiz,

first of all, thanks a lot for the good job you did with sqlite for us all!

  So, now my app can understand a timestamp field as a TDateTime instead
  of a string...
 ..
[removed]
...

 Here's how sqlite works (for good and bad):

 - You can create tables with any field type: TIMESTAMP, TIME_STAMP,
 QWERTY etc
 - In any of this field type you can store anything: a integer, a
 float, a string

 Many sqlite managers make assumptions (each one create its own
 ..
[removed]
...

I'm perfectly aware of that and I'm living happily with it...it's an
embedded database anyway!

I don't expect a QWERTY type to be understood, of course, but I
thought a timestamp might, because the sqlite.org documentation
http://www.sqlite.org/lang_createtable.html
refers to it. And SQLiteAdmin and SQLite Manager and SQLite Firefox
extension can understand it.
Anyway, as you said, it is opensource and with a very open license, so
I just added the three lines of code I needed: my post number 1) is
just to share it.
The code needed is only:

Index: sqlite3ds.pas
===
--- sqlite3ds.pas   (revision 100)
+++ sqlite3ds.pas   (working copy)
@@ -165,6 +165,10 @@
begin
  AType:= ftTime;
  FieldSize:=SizeOf(TDateTime);
+   end else if (ColumnStr = 'TIMESTAMP') then
+   begin
+ AType:= ftDateTime;
+ FieldSize:=SizeOf(TDateTime);
end else if (ColumnStr = 'TEXT') then
begin
  AType:= ftMemo;

It's not expensive from the point of view of the code performance nor
lightweight.
Even better, one could also assign AType := ftTimeStamp (which is
alreay defined in db.pas) and then change also db.pas accordingly:

Index: db.pas
===
--- db.pas  (revision 101)
+++ db.pas  (working copy)
@@ -1900,7 +1900,7 @@
   { ftInterface} Nil,
   { ftIDispatch} Nil,
   { ftGuid} TGuidField,
-  { ftTimeStamp} Nil,
+  { ftTimeStamp} TDateTimeField,
   { ftFMTBcd} Nil,
   { ftFixedWideString} TWideStringField,
   { ftWideMemo} TWideMemoField


I haven't seen the source code of the tools I mentioned above, but I
guess that sqlite3ds would behave in the same way if you change the
IFs like:
   if (ColumnStr = 'TIME')
into
   if ( Pos('TIME',ColumnStr)  0 )
which is similar to what you do with BOOL, except that 0 understands
the CURRENT_TIME type that you can find in the documentation of sqlite

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] SQLite 3 datetime and timestamp

2007-12-03 Thread Roberto Padovani
Now, about assumptions.

in sqlite3ds there is the assumption that BOOLEAN fields are stored as
1 or 0. In fact, to recover a db that had TRUE and FALSE, I made a
new class where I changed ftBool to fString. In this way I could read
them, parse them and then write them back as 1 or 0.

With the dates, the problem is similar, because sqlite3ds understands
that the field is of type DATE, and so it makes the following
assumption in customsqliteds.pas line 603:

ftFloat,ftDateTime,ftTime,ftDate,ftCurrency:
  begin
Val(StrPas(FieldRow),Double(Buffer^),ValError);
Result:= ValError = 0;
  end;

In the database I have, the dates are in the ISO standard form
2007-12-03 12:11:10.1234
How do you suggest me to handle with them ?
1) by complicating the SQL queries with SELECT date(field_name) as
field_name FROM... which turns the field_name into a string in the
result set
2) by subclassing or anyway changing the TFieldType ?
3) like with boolean, by making a special temporary class that parses
the whole database (not so big) and changes the dates into
Freepascal-style doubles (are they stored more efficiently ?)
4) other (please specify :-))

My brain-storming last night came up with the idea of adding a flag
that says force every field as a string: this would let someone who
doesn't know which convention was used in which field to inspect it.
Is it somewhat crazy ?

By the way, I really like sqlite and the unit you made to access it.
When the project I'm working on is finished, I'll strip everything
from the source code and only leave a detailed tutorial for using
sqlite without visual components. Meanwhile, I read somewhere in the
mailing that you are writing a documentation for sqlite3ds; is it
ready or partially ready ?
I'm studying the whole code at the moment and some documentation would
help a lot, especially to see the global structure, to get the large
picture of it. Moreover, I'm going to keep on working a lot with
sqlite, so if some contribution is needed somewhere, let me know.

Thanks a lot,

 Roberto

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Main Form retreiving data from Child Form

2007-12-03 Thread Roberto Padovani
You can use public variables (or a private variable with the
corresponding public methods for reading and writing to it, or even
better a property). For simplicity, let's say that we go with the
public variables.
Let TMainForm be the class name of the main form.
In the child form class, you could declare a public variable like:
formMainReference : TMainForm
and then in the main form you do a:

formChild := TFormChild.Create(self);
formChild.formMainReference := self;
formChild.Show;

the in the child form code you can do:

formMainReference.editBoxInMainForm.Text := 'hello';

You can also do the other way round, but beware not to free the child
before accesing the data.

By the way, I never tried it, but did you notice that by creating the
child form:
formChild := TFormChild.Create(self);
you are passing a reference of the calling form ? Any TComponent
object has a Owner property, so that formChild.Owner  is the main
form.
You only need to type cast it to a TFormMain in order to use it.

.02

R#


2007/12/3, el stamatakos [EMAIL PROTECTED]:

  Hi All,
   I have an MDI application in which I have two forms. Form1 (Main form) and
 form2 (Child Form). In form 2 I have some TComboBox and TEdit Components. In
 the main form I have some TEdit components. I would like Form1(MainForm)
 TEditBox to have info from Form2(Child Form) TEditBox. I thought of two ways
 of doing this and would like to know if there is a better way

  Method 1. TIniFile. When I close form2 I write to a .ini the contents of
 form2. Then When I Activate Form1 (OnActivate) I read the info from .ini and
 fill in the info into the TEdit.

  Method 2. I use global variables. When I close Form2 I have global
 variables that store the contents of TEdit from Form2. When I go to Activate
 form1(OnActivate) I use the global variables and assign to the TEdit in
 Form1.

  Please let me know if there is a better way. I do not feel too good about
 global variables since it is a little scary and not good practise and
 TIniFiles are a little cubersome. Is there a better way in Lazarus. Thanks

  Lefti



-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Main Form retreiving data from Child Form

2007-12-03 Thread Roberto Padovani
yeah, add unit1 in the uses clause of unit2 and add unit2 in the
uses clause of unit1.

R#

2007/12/3, el stamatakos [EMAIL PROTECTED]:

  Hi R#
   I am not sure I follow.

  in my ChildForm when I declare formMainReference : TMainForm it does not
 know what TMainForm is since unit2 has no idea about unit1 (MainForm). Can
 you give me the details of what unit1(MainForm) and unit2(ChildForm) looks
 like since I cannot get it to work. Thanks.

  Best,
  Lefti

  Date: Mon, 3 Dec 2007 21:24:29 +0100
  From: [EMAIL PROTECTED]
  To: lazarus@miraclec.com
  Subject: Re: [lazarus] Main Form retreiving data from Child Form

 
  You can use public variables (or a private variable with the
  corresponding public methods for reading and writing to it, or even
  better a property). For simplicity, let's say that we go with the
  public variables.
  Let TMainForm be the class name of the main form.
  In the child form class, you could declare a public variable like:
  formMainReference : TMainForm
  and then in the main form you do a:
 
  formChild := TFormChild.Create(self);
  formChild.formMainReference := self;
  formChild.Show;
 
  the in the child form code you can do:
 
  formMainReference.editBoxInMainForm.Text := 'hello';
 
  You can also do the other way round, but beware not to free the child
  before accesing the data.
 
  By the way, I never tried it, but did you notice that by creating the
  child form:
  formChild := TFormChild.Create(self);
  you are passing a reference of the calling form ? Any TComponent
  object has a Owner property, so that formChild.Owner is the main
  form.
  You only need to type cast it to a TFormMain in order to use it.
 
  .02
 
  R#
 
 
  2007/12/3, el stamatakos [EMAIL PROTECTED]:
  
   Hi All,
   I have an MDI application in which I have two forms. Form1 (Main form)
 and
   form2 (Child Form). In form 2 I have some TComboBox and TEdit
 Components. In
   the main form I have some TEdit components. I would like Form1(MainForm)
   TEditBox to have info from Form2(Child Form) TEditBox. I thought of two
 ways
   of doing this and would like to know if there is a better way
  
   Method 1. TIniFile. When I close form2 I write to a .ini the contents of
   form2. Then When I Activate Form1 (OnActivate) I read the info from .ini
 and
   fill in the info into the TEdit.
  
   Method 2. I use global variables. When I close Form2 I have global
   variables that store the contents of TEdit from Form2. When I go to
 Activate
   form1(OnActivate) I use the global variables and assign to the TEdit in
   Form1.
  
   Please let me know if there is a better way. I do not feel too good
 about
   global variables since it is a little scary and not good practise and
   TIniFiles are a little cubersome. Is there a better way in Lazarus.
 Thanks
  
   Lefti
  
 
 
  --
  --
  Ing. Roberto Padovani
 
  via Mandrioli, 1
  40061 Minerbio (BO)
  Italy
 
  mail: [EMAIL PROTECTED]
  cell: 340-3428685
  -
 
 
 _
  To unsubscribe: mail [EMAIL PROTECTED] with
  unsubscribe as the Subject
  archives at
 http://www.lazarus.freepascal.org/mailarchives




-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] SQLite 3 datetime and timestamp

2007-12-02 Thread Roberto Padovani
Hi all!

two things: 1) a (possible) improvement to sqlite3ds; 2) the old
problem with dates and time

1) I found a sqlite database that uses the TIMESTAMP data type, but
this is not directly supported by the Tsqlite3Dataset written by Luiz.
I added the if-else checks in sqlite3ds.pas for this type, which
refers to ftTimestamp of TFieldType in db.pas. And I also added
db.DefaultFieldClasses[ftTimeStamp] := TDateTimeField at run-time,
because in db.pas it is defined as nil (and I didn't want to recompile
it).
So, now my app can understand a timestamp field as a TDateTime instead
of a string...

2)and here comes the problem! The code:

var d: TDateTime;
..
d := database.FieldByName('birthday').asDateTime;
...
will always store the zero date: 30 Dec 1899
why ?

Being urgent, at the moment I am reading the dates as strings by using
the date or datetime function of SQLite in the query, i.e.:

SELECT date(birthday) AS string_birthday FROM people;

and then parsing them with the powerful functions in the freepascal
RTL, but I would like to understand this once for all.

Can anyone help ?
Thanks !!

R#

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] SQLite 3 datetime and timestamp

2007-12-02 Thread Roberto Padovani
Hi all!

two things: 1) a (possible) improvement to sqlite3ds; 2) the old
problem with dates and time

1) I found a sqlite database that uses the TIMESTAMP data type, but
this is not directly supported by the Tsqlite3Dataset written by Luiz.
I added the if-else checks in sqlite3ds.pas for this type, which
refers to ftTimestamp of TFieldType in db.pas. And I also added
db.DefaultFieldClasses[ftTimeStamp] := TDateTimeField at run-time,
because in db.pas it is defined as nil (and I didn't want to recompile
it).
So, now my app can understand a timestamp field as a TDateTime instead
of a string...

2)and here comes the problem! The code:

var d: TDateTime;
..
d := database.FieldByName('birthday').asDateTime;
...
will always store the zero date: 30 Dec 1899
why ?

Being urgent, at the moment I am reading the dates as strings by using
the date or datetime function of SQLite in the query, i.e.:

SELECT date(birthday) AS string_birthday FROM people;

and then parsing them with the powerful functions in the freepascal
RTL, but I would like to understand this once for all.

Can anyone help ?
Thanks !!

R#

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Child Form not being created

2007-11-30 Thread Roberto Padovani
what happens if you call Child.Show ?

2007/11/29, Mattias Gaertner [EMAIL PROTECTED]:
 On Thu, 29 Nov 2007 12:10:38 -0800
 el stamatakos [EMAIL PROTECTED] wrote:

 
  Hi All,
 
   I have the following situation. I have 2 forms. Form1 and Form2
 
  In Form1 (unit1.pas) I use a TMainMenu and I have a Menu Project-New
 
  when I click on Project-New another form should pop up. This used to
  work but for some reason it does not any longer.
  I have an EventHandler for Project-New that is MenuNewItemClick and
  this is defined on OnClick
  it is in unit1.pas
 
  ---unit1.pas
 
  uses
  CreateChild
  ...
  ...
  ...
 
  procedure TForm1.MenuItemNewClick(Sender:TObject);
  begin
  CreateChild;
  end;
 
  I then define
 
  procedure TForm1.CreateChild;
  var
  Child:TChildForm;
  begin
  Child:=TChildForm.Create(Self);
  end;

 Should work.
 Is Child.visible = true?


  1) I have an MDI application and when I clicked on a menu it would
  open another form. Now it does not any idea how I can fix this.Can
  you give a little more information ?



 Mattias

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives



-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] MySql 4.1 Database Questions

2007-11-29 Thread Roberto Padovani
2007/11/29, el stamatakos [EMAIL PROTECTED]:

  Hi,
   I finally got passed the

  Project Raised exception class 'EInOutError with message:
 Can not load MySQL library libmysqlclient.so. Please check your
 installation. Indeed I had to create a symbolik link.


a symbolic link in the project folder is just fine, but probably the
system should be configured so that the path to libmysqlclient is int
the list of default paths to search dynamic libraries in

R#

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus-0.9.24: SIGSEGV in TOpenDialog

2007-11-29 Thread Roberto Padovani
That happens if you did this:

- drop a TOpenDialog on the form
- write the button event handler
- delete the TOpenDialog icon from the form because you think it's
ugly over there
- re-type manually the declaration OpenDialog1: TOpenDialog;   in
the form class because it was automatically deleted by the previous
step
- compiled and run

I don't know if you didd this, but this is way to get the SIGSEV that you say.

The reason is that if you leave the icon on the form, lazarus will
take care of creating (and freeing) the class hinstance, so that
OpenDialog1 is not nil when after the form is created.
But if you followed the steps above, then you have to take care of it yourself:

1) place a OpenDialog1 := TOpenDialog.Create(self);  in the FormCreate event
2) place a OpenDialog1.free; in the FormClose event (or anywhere when
you don't need it anymore)

hope it helps

R#

2007/11/29, Igor Zakhrebetkov [EMAIL PROTECTED]:
 I've installed Lazarus-0.9.24-fpc-2.2.0-20071114-win32.exe on Windows XP SP2 
 with some
 components like TDBF .

 Simple demo application with TOpenDialog component:
 ===
TForm1 = class(TForm)
  Button1: TButton;
  OpenDialog1: TOpenDialog;
  procedure Button1Click(Sender: TObject);
private
  { private declarations }
public
  { public declarations }
end;

 var
Form1: TForm1;

 implementation

 { TForm1 }

 procedure TForm1.Button1Click(Sender: TObject);
 begin
if OpenDialog1.Execute then
 ShowMessage(OpenDialog1.FileName);
 end;
 ===
 After trying to pick up any file I've got an error with message:

 Project project1 raised exception class 'External: SIGSEGV'.

 Sometimes it simply hangs.
 There were no such problems with previous version.

 --
 Igor Zakhrebetkov

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives



-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Contribution?

2007-11-28 Thread Roberto Padovani
Recently, there has been a discussion on possible copyright
infringement and the need of rewriting clean sorting algorithms...if
you are clean from delphi and/or kylix sources, have a look at those
messages and see.

R#

2007/11/27, Marco Alvarado [EMAIL PROTECTED]:
 That's what I was looking for, thanks! :D


 2007/11/27, Vincent Snijders [EMAIL PROTECTED]:
  Marco Alvarado schreef:
   The Lazarus project is really cool, and I'd like to contribute. Is
   there any area that needs help?
 
  There are a lot of areas. Did you read
  http://wiki.lazarus.freepascal.org/How_To_Help_Developing_Lazarus ?
 
  Vincent
 
  _
   To unsubscribe: mail [EMAIL PROTECTED] with
  unsubscribe as the Subject
 archives at http://www.lazarus.freepascal.org/mailarchives
 

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives



-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] some questions

2007-11-28 Thread Roberto Padovani
about accessing databases, there is a tutorial:
http://wiki.lazarus.freepascal.org/Lazarus_Database_Tutorial
which is only a very brief introduction, but it's much better than nothing.
After going through it a few times, after going through the forums
many times, and after stumbling upon even more access violation
errors, I managed to working with sqlite and mysql...at least for
simple queries.
In my project I went on with sqlite only, but the dataset interfaces
are basically always the same; this is a very active list and if you
ask, you'll probably get an answer.

R#

2007/11/28, el stamatakos [EMAIL PROTECTED]:

  Hi All,
   I would like to start by saying Lazarus seems like the answer I have
 been looking for, for a long time. I love Delphi and have finally found
 something similar for Linux.
   I have a few questions, first I registered to the forums but never
 received an e-mail back with password so I cannot log in.
   I have two questions that pertain to the Linux version of Lazarus

  1) I use a form and then I click in the OnCreate Event Handler in the
 object inspector and it returns an error Unable to find method. Plz fix the
 error shown in the message window.. I look at the message window and the
 error is Error:unit not found:Forms. I take the same code into windows and
 do not have this problem. Any ideas.

  2) I would like to use MySQL with Lazarus. I have no idea where to start. I
 placed a MySQL50conn module. I then tried to connect to the database using
 the HostName, DatabaseName, userName, password. Is there a field for port?
 Is there a simple example to retrieve data from a MySQL. I have a form that
 essentially has some combobox and they are to be filled with info from the
 MySQL database. Please help. Thanks

  I look forward to joining the forums and receiving help. Thanks in advance.

  Lefti



-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] SQLite 3 -- Capture FieldValues into a variable

2007-11-26 Thread Roberto Padovani
2007/11/26, Daniel Rincón García [EMAIL PROTECTED]:
 Hi, I need to capture the FieldValues of a SQLite database into a string
 variable.

 If I do it:

while not dsTest.EOF do
  begin
  DataToSend := DataToSend +
 dsTest.FieldValues ['Code'] + '\' +
 dsTest.FieldValues['Name'] + '\' +
  dsTest.FieldValues['Address'] + '#';


provided that DataToSend is a string (as I suppose), you should do this:

DataToSend := DataToSend + dsTest.FieldByName('Code').AsString;

since FieldByName() returns a TField, have a look at the other methods
for type casting.
There is basically everything: AsInteger, AsBoolean, and so on..
This also explains why your second code happened to work.

Now I'll break every netiquette rule and change (partially) subject:

To the Great Guys of the lazarus project:

I am finishing a medium size project with lazarus + sqlite3, for which
I had study and experiment a lot due to the fact that, IMHO, the
database tutorial was slightly too quick on the sqlite part.
Would you appreciate it if I wrote a tutorial (= commented example) on
sqlite3 with basic topics like the one above and the not so trivial
date management stuff ?
If you don't really care about it, I won't spend time on it; but if
you do care, please point me to the instructions for the wiki and/or a
tutorial page templatethis will be my Christmas present to the
Lazarus project. :-)

Roberto

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives