Re: [DUG] Create new table from existing one.
Wallace Is their any overriding reason you are using dBase tables? Its a bit dated? If I was doing a single user app, that didn't interact with an external report writer etc, I'd use kbmMemtable otherwise its difficult to go past MS SQL free versions (or Firebird) which being SQL servers give you quite a bit more 'grunt' hat version of Delphi are you running? Neven > I am using Dbase tables and when I create a new table from and > existing one, the real number fields are being created as equivalent > to integers. I was using TDBF from Sourceforge, so I reverted back to > Delphi's own tables and I have exactly the same problem. > > Using the Database desktop with the newly created file, all the real > numeric fields have field names but incorrectly shown with no length. > Does Dbase have to have a certain numeric field length to work ? > > Probably not, because making the file manually, as below, should have > then worked. > > Both options below make no difference. > >tblSave := TTable.Create(Application); >with tblSave do begin > Active:=False; > TableType:=ttDBase; > TableName := fFiles.eDir.text+'\'+fFiles.eFile.text+'.dbf'; > Name:=fFiles.eFile.text; > > => FieldDefs.Assign(dm.tblOper.FieldDefs); // Automatically assign > > => with FieldDefs do begin // Manually Assign > Clear; > for i := 0 to (dm.tblOper.FieldCount -1) do Begin > if dm.tblOper.Fields[i].Datatype=ftString then > Add(trim(copy(dm.tblOper.Fields[i].Name,8,10)), ftString, > 30, False); > if dm.tblOper.Fields[i].Datatype=ftSmallint then > Add(trim(copy(dm.tblOper.Fields[i].Name,8,10)), > ftSmallint, 0, False); > if dm.tblOper.Fields[i].Datatype=ftMemo then > Add(trim(copy(dm.tblOper.Fields[i].Name,8,10)), ftMemo, > 0, False); > if dm.tblOper.Fields[i].Datatype=ftFloat then > Add(trim(copy(dm.tblOper.Fields[i].Name,8,10)), ftFloat, > 0, False); > end; > end; > Look like the only way I can get a new file with the same structure is > to use a dos copy, open the file and delete all the records. > > Any other suggestions ? > > Thanks Wallace > > > > > ___ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: > unsubscribe ___ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe
Re: [DUG]: create
>Say I want to create the new panel in my current code, but not on the same form... >Q is; how to create and free such a beast so that it is independent of the >current mainform. It needs to be a 640x480 panel which I will actually >locate off the screen. >Does it have to me made showmodal?? The code below makes a form and a panel and shows the form offscreen giving a handle to the panel (called ThePanel) so that you can alter its behaviour assign events and such... Creation and destruction are performed at entry and exit of the application... I dunno if this is what you want or not... Note that it isn't showmodal so it should be fine... There might be more management of the offscreen form though... unit Unit1; interface uses ExtCTrls,Forms; var ThePanel :TPanel; implementation var HolderForm :TForm; initialization HolderForm := TForm.Create(nil); with HolderForm do begin Left := -1000; Top := -1000; Show; end; ThePanel := TPanel.Create(HolderForm); with ThePanel do begin Parent := HolderForm; Width := 640; Height := 480; end; finalization HolderForm.Free; end. -- Aaron Scott-Boddendijk Jump Productions (07) 838-3371 Voice (07) 838-3372 Fax --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
RE: [DUG]: create
>Hash: SHA1 > >Does it have to do also whether the panel is visible i.e. does the owner >have to be the form for the panel to be visible on that form? No, that's the Parent property. Check out Owner and Parent in the help. Cheers, Carl Reynolds Ph: +64-9-4154790 CJN Technologies Ltd. Fax: +64-9-4154791 [EMAIL PROTECTED]DDI: +64-9-4154795 PO Box 302-278, North Harbour, Auckland, New Zealand 12 Piermark Drive, North Harbour Estate, Auckland, NZ Visit our website at http://www.cjntech.co.nz/ --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
Re: [DUG]: create
>Does it have to do also whether the panel is visible i.e. does the owner >have to be the form for the panel to be visible on that form? No the Parent property is used for display purposes. The owner is used for resource management. -- Aaron Scott-Boddendijk Jump Productions (07) 838-3371 Voice (07) 838-3372 Fax --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
Re: [DUG]: create
Heres an EasySqueezy one for someone: >What is the difference between > panel:=tpanel.Create(owner); >and > panel:=tpanel.Create(self); When you're in a method a self reference is available to the instance of the object this method belongs to... On Objects derived from TComponent (IE all controls) have an Owner property... so the lines you gave essentially are saying... panel:=tpanel.Create(self.owner); and panel:=tpanel.Create(self); All TComponents on being Freed also free anything they 'own' and so when self.owner is freed the panel will be freed. If you pass NIL as the owner EG panel:=tpanel.Create(NIL); you will need to Free the panel yourself since it has no owner to do so... >Normally I use self, but in this case I want to make a panel, which is like >a modal construct, or separate from the main form, so I take it OWNER would >be the one? If it's created on the fly you can create and free it yourself but since it's the 'main' form this form lives the entire time anyway. To move a panel from one form to another change it's Parent property... note that Parent is different from Owner Owner denotes a responsibility to control resource use and Parent denotes a hierarchy for input (keystroke passing to parents for example) and output (drawing on a form). >BTW when the proc is finished, do both instances need panel.destroy when the proc exits you should always release any resources you are certain will not be needed outside of the procedure but you should use the Free method not Destroy. Although they currently have a symmetric behaviour (apart from the near worthless check to see if the handle is nil in Free) this might change and for future reliability of your code your should only call Free. -- Aaron Scott-Boddendijk Jump Productions (07) 838-3371 Voice (07) 838-3372 Fax --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
RE: [DUG]: create
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Does it have to do also whether the panel is visible i.e. does the owner have to be the form for the panel to be visible on that form? > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On > Behalf Of Carl Reynolds > Sent: Monday, 29 March 1999 08:57 > To: Multiple recipients of list delphi > Subject: RE: [DUG]: create > > > >What is the difference between > > panel:=tpanel.Create(owner); > >and > > panel:=tpanel.Create(self); snp ; -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.0.2i iQA/AwUBNv35BJ/ufSMMVdBMEQIXTQCgluuVgtLwBVnlK/2c0BtrVFvoC/0AoMhb z5hzcjcYj7DGnTPBosImM1Dv =l16h -END PGP SIGNATURE- --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
RE: [DUG]: create
>What is the difference between > panel:=tpanel.Create(owner); >and > panel:=tpanel.Create(self); The owner is the object, if any, that will free your panel automatically when its free'd itself (often when the application ends), so you don't have to. If you free it explicitly then it doesn't matter - you could put panel := TPanel.Create(nil). >BTW when the proc is finished, do both instances need panel.destroy Use panel.Free, not panel.Destroy. In either instance you can leave this out - because you set a value for Owner, your Owner will free it moments before it itself is free'd. EasySqueezy :) >Cheers, >Alistair+ Cheers, Carl Reynolds Ph: +64-9-4154790 CJN Technologies Ltd. Fax: +64-9-4154791 [EMAIL PROTECTED]DDI: +64-9-4154795 PO Box 302-278, North Harbour, Auckland, New Zealand 12 Piermark Drive, North Harbour Estate, Auckland, NZ Visit our website at http://www.cjntech.co.nz/ --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz