[DUG]: Colouring TListbox Headers

2003-10-30 Thread Stephen Bertram
Hi All

Can anyone give me a quick pointer on how to change the colour of TButton and the 
column headers in TListBox? I know there are third party components, but there are 
reasons why I want to use the basic windows controls.

I'm using Delphi 5.

TIA

Stephen
Disclaimer : This communication contains information that is confidential and the 
copyright of ensynergy Limited or a third party. If you are not the intended recipient 
of this communication please delete and destroy all copies and telephone ensynergy 
Limited on +64 9 3551591 immediately. If you are the intended recipient of this 
communication you should not copy, disclose or distribute this communication without 
the authority of ensynergy Limited. Any views expressed in this communication are 
those of the individual sender, except where the sender specifically states them to be 
the views of ensynergy Limited. Except as required by law, ensynergy Limited does not 
represent, warrant and/or guarantee that the integrity of this communication has been 
maintained nor that the communication is free of errors, virus, interception or 
interference.

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


[DUG]: TOLEContainer problem

2003-08-27 Thread Stephen Bertram
Hi All

I am using the TOLEContainer (in Delphi 5) for the first time and have struck a sizing 
issue.

I have placed the TOLEContainer in a TPanel as recommended in the help, but as soon as 
the OLEObject is activated it expands the TPanel to fill the owning form, regardless 
of the other components on the form.  

While I assume I can use a TFrame to contain the TOLEContainer, I can't see how to 
merge the tool bars on the main form.

Can anyone assist?

TIA

Stephen
Disclaimer : This communication contains information that is confidential and the 
copyright of enSynergy Limited or a third party. If you are not the intended recipient 
of this communication please delete and destroy all copies and telephone enSynergy 
Limited on +64 9 3551591 immediately. If you are the intended recipient of this 
communication you should not copy, disclose or distribute this communication without 
the authority of enSynergy Limited. Any views expressed in this Communication are 
those of the individual sender, except where the sender specifically states them to be 
the views of enSynergy Limited. Except as required by law, enSynergy Limited does not 
represent, warrant and/or guarantee that the integrity of this communication has been 
maintained nor that the communication is free of errors, virus, interception or 
interference.

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


RE: [DUG]: Some Ideas?

2003-07-30 Thread Stephen Bertram
Why not use IIS linked through to your SQL Server and get the result as a XML stream 
via HTTP?

You can use IIS security and even HTTPS if required. Just use Configure XML Support 
in IIS from the SQL Server menu to set it up.

Stephen

-Original Message-
From: vss [mailto:[EMAIL PROTECTED]
Sent: Thursday, 31 July 2003 10:55 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Some Ideas?


Hi All.
We have a project that we need to expand out to other locations.
Currently, we have certain client sites who connect to us and are part of 
our IPNetwork, which means we can open up port 1433 for MS SQLServer to 
ONLY these people.
BUT with some changes that are in the wings we will need to provide the 
APP. to people who wont connect us. This means they will not be part of 
our IPNetwork and therefore wont be able to connect to port1433 for SQL 
Server.
There is quite a bit of data that needs to be passed around, and XML 
looks promising, but after 2 days of looking and trying and testing, I am 
kinda going off it.
The only promising part IS, that I can use an ADOTable for instance and 
save teh record to an XML file, and load in from an XML file, BUT it has 
to contain all the record source/set info and is kinda special looking.
This mean that I cant use FOR XML in the SQL statement to export the data 
to XML as it cant be loaded my an ADOTable.
The solution that I thought if was to have a webpage that a request is 
sent to, which fires off a Delphi COM obj. that has an ADOQuery object 
and an ADOTable object so you run a query via the control, save it to 
file, the send the contents of the file back to the APP. which can then 
be loaded into the ADOTable in the app. and all is happy. BUT this as you 
can tell is kinda messy.

Can anyone else suggest another alternative? other than Soap etc. as we 
cant really open ports up as the info is VERY sensitive. 
oh PS. the XML is also encrypted before it goes and decrypted on the 
client..BTW


Cheers,Jeremy

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
Disclaimer : This communication contains information that is confidential and the 
copyright of enSynergy Limited or a third party. If you are not the intended recipient 
of this communication please delete and destroy all copies and telephone enSynergy 
Limited on +64 9 9205441 immediately. If you are the intended recipient of this 
communication you should not copy, disclose or distribute this communication without 
the authority of enSynergy Limited. Any views expressed in this Communication are 
those of the individual sender, except where the sender specifically states them to be 
the views of enSynergy Limited. Except as required by law, enSynergy Limited does not 
represent, warrant and/or guarantee that the integrity of this communication has been 
maintained nor that the communication is free of errors, virus, interception or 
interference.

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


RE: [DUG]: ADOTables and XML files

2003-07-29 Thread Stephen Bertram
Have you tried FOR XML RAW ?

Stephen

-Original Message-
From: vss [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 30 July 2003 1:38 p.m.
To: Multiple recipients of list delphi
Subject: [DUG]: ADOTables and XML files


HI All.
I have come back to looking at loading XML files into ADO Tables for a 
small project I am looking at.
If I take a standard (if there is such a thing) XML file and try to load 
it into an ADOTable it tells me the XML file is incomplete or invalid.
I then ran a query via an ADOQuery, then did savetofile the did 
loadfromfile into the ADOTable, and it works.
Ok, so I then looked at the XML, and its got headers that I have never 
seen before, but I can see what its on about.
My main question IS, I will be getting the XML data from SQL Server 2000 
which lets you do,  SELECT * FROM Products FOR XML,AUTO which will 
export to XML.
Does anyone else do this, or similar ? how do I get SQL Server to 
generate the headers that the ADOTable seems to need etc?

Thanks, Jeremy

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
Disclaimer : This communication contains information that is confidential and the 
copyright of enSynergy Limited or a third party. If you are not the intended recipient 
of this communication please delete and destroy all copies and telephone enSynergy 
Limited on +64 9 9205441 immediately. If you are the intended recipient of this 
communication you should not copy, disclose or distribute this communication without 
the authority of enSynergy Limited. Any views expressed in this Communication are 
those of the individual sender, except where the sender specifically states them to be 
the views of enSynergy Limited. Except as required by law, enSynergy Limited does not 
represent, warrant and/or guarantee that the integrity of this communication has been 
maintained nor that the communication is free of errors, virus, interception or 
interference.

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


RE: RE: [DUG]: ADOTables and XML files

2003-07-29 Thread Stephen Bertram
Sorry Jeremy - I haven't used XML in Delphi yet, only in Javascript.

I remember major issues getting compatible XML formats - so much for a universal 
standard data format :-(

Cheers 

Stephen

-Original Message-
From: vss [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 30 July 2003 1:56 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: ADOTables and XML files


yip. but it gives me a different error now.

Are you doing this Stephen? Maybe if you are and it works ok for you, I 
might be doing something wrong?

Jeremy

-Original Message-
From: Stephen Bertram [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Date: Wed, 30 Jul 2003 13:46:52 +1200
Subject: RE: [DUG]:  ADOTables and XML files

 Have you tried FOR XML RAW ?
 
 Stephen
 
 -Original Message-
 From: vss [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, 30 July 2003 1:38 p.m.
 To: Multiple recipients of list delphi
 Subject: [DUG]: ADOTables and XML files
 
 
 HI All.
 I have come back to looking at loading XML files into ADO Tables for
 a=20
 small project I am looking at.
 If I take a standard (if there is such a thing) XML file and try to
 load =
 
 it into an ADOTable it tells me the XML file is incomplete or invalid.
 I then ran a query via an ADOQuery, then did savetofile the did=20
 loadfromfile into the ADOTable, and it works.
 Ok, so I then looked at the XML, and its got headers that I have
 never=20
 seen before, but I can see what its on about.
 My main question IS, I will be getting the XML data from SQL Server
 2000 =
 
 which lets you do,  SELECT * FROM Products FOR XML,AUTO which will=20
 export to XML.
 Does anyone else do this, or similar ? how do I get SQL Server to=20
 generate the headers that the ADOTable seems to need etc?
 
 Thanks, Jeremy
 
 ---
 --=
 --
 New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
   Website: http://www.delphi.org.nz
 To UnSub, send email to: [EMAIL PROTECTED]
 with body of unsubscribe delphi
 Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
 Disclaimer : This communication contains information that is =
 confidential and the copyright of enSynergy Limited or a third party.
 If =
 you are not the intended recipient of this communication please delete
 =
 and destroy all copies and telephone enSynergy Limited on +64 9 9205441
 =
 immediately. If you are the intended recipient of this communication
 you =
 should not copy, disclose or distribute this communication without the
 =
 authority of enSynergy Limited. Any views expressed in this =
 Communication are those of the individual sender, except where the =
 sender specifically states them to be the views of enSynergy Limited. =
 Except as required by law, enSynergy Limited does not represent,
 warrant =
 and/or guarantee that the integrity of this communication has been =
 maintained nor that the communication is free of errors, virus, =
 interception or interference.
 
 ---
 
 New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
   Website: http://www.delphi.org.nz
 To UnSub, send email to: [EMAIL PROTECTED] 
 with body of unsubscribe delphi
 Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
Disclaimer : This communication contains information that is confidential and the 
copyright of enSynergy Limited or a third party. If you are not the intended recipient 
of this communication please delete and destroy all copies and telephone enSynergy 
Limited on +64 9 9205441 immediately. If you are the intended recipient of this 
communication you should not copy, disclose or distribute this communication without 
the authority of enSynergy Limited. Any views expressed in this Communication are 
those of the individual sender, except where the sender specifically states them to be 
the views of enSynergy Limited. Except as required by law, enSynergy Limited does not 
represent, warrant and/or guarantee that the integrity of this communication has been 
maintained nor that the communication is free of errors, virus, interception or 
interference.

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


RE: [DUG]: Integer conversion

2003-07-27 Thread Stephen Bertram
try Format('%2.2d',[IntValue])

-Original Message-
From: Leigh Wanstead [mailto:[EMAIL PROTECTED]
Sent: Monday, 28 July 2003 10:49 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Integer conversion


Hello everyone,

I want to convert integer to string. 

Here is the rule

Integer String
1   '01'
2   '02'
3   '03'
4   '04'
5   '05'
6   '06'
11  '11'
12  '12'

It convert int to string, if width less than 1, put '0' in front of String.

I checked help file about format and can not find the right one I want.

TIA

Regards
Leigh

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
Disclaimer : This communication contains information that is confidential and the 
copyright of enSynergy Limited or a third party. If you are not the intended recipient 
of this communication please delete and destroy all copies and telephone enSynergy 
Limited on +64 9 9205441 immediately. If you are the intended recipient of this 
communication you should not copy, disclose or distribute this communication without 
the authority of enSynergy Limited. Any views expressed in this Communication are 
those of the individual sender, except where the sender specifically states them to be 
the views of enSynergy Limited. Except as required by law, enSynergy Limited does not 
represent, warrant and/or guarantee that the integrity of this communication has been 
maintained nor that the communication is free of errors, virus, interception or 
interference.

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


RE: [DUG]: What's up with the DUG? - The good news

2003-07-27 Thread Stephen Bertram
Title: myOffice Email Message



Yay!! 


All 
power to the keepers of the list !!!

Thanks 
guys for all the good work.

Stephen

-Original Message-From: 
Gary T. Benner [mailto:[EMAIL PROTECTED]Sent: Monday, 28 July 
2003 11:35 a.m.To: Multiple recipients of list 
delphiSubject: [DUG]: What's up with the DUG? - The good 
news
Hi all, 
  Just to let you all know that our 
  new Linux based Mailman system is now installed and being tested. 
  Watch this space. 
  Gary  Steve 
  List Admins.
  Gary 
  Benner - Software Developer [EMAIL PROTECTED]Lecturer in Information 
  Technology - Waiariki Institute of TechnologyRef#: 
  41006
~~  This communication contains information that is confidential and the copyright of enSynergy Limited or a third party.  If you are not the intended recipient of this communication please delete and destroy all copies and telephone enSynergy Limited on +64 9 9205441 immediately. If you are the intended recipient of this communication you should not copy, disclose or distribute this communication without the authority of enSynergy Limited.  Any views expressed in this Communication are those of the individual sender, except where the sender specifically states them to be the views of enSynergy Limited.  Except as required by law, enSynergy Limited does not represent, warrant and/or guarantee that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.




[DUG]: ADO funny

2003-05-27 Thread Stephen Bertram
Hi All

A strange occurrence which I am unable to explain, but I feel that I have seen before. 
 This is with Delphi 5 and SQL Server 2000.

We have a thread which updates a SQL Server database via a stored procedure when 
monitored data in the application is changed or added.  The thread instantiates its 
own TADOConnection and a TADOStoredProc.  As changed data is detected the 
TADOStoredproc's parameters are updated and the ExecProc method called. The purpose of 
the thread is to pipeline database updates from the 20 - 500+ execution threads 
handling client processes. 

On one machine (Windows Server 2000) the second time the ExecProc method is called the 
application vanishes - no errors, no Dr Watson.  On all other machines we run it on 
the application behaves beautifully.  The failure occurs with only 12 active threads, 
so it does not seem to be load related as the application happily runs in the real 
world with over 1500 threads.

The fix has been to instantiate the TADOStoredProc for every database update and then 
free it.  While this works it is not elegant and as it may run up to 100 times a 
second the inefficiency is a problem.

Any ideas what may be the cause, either from the ADO components or the Windows 200 
Server environment?

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


RE: RE: [DUG]: ADO funny

2003-05-27 Thread Stephen Bertram
Definitely - you don't get far without it :-)

Stephen

-Original Message-
From: David at McNeill Computers [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 28 May 2003 11:39 a.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: ADO funny


Have you applied the ADO Update 2 from Borland to your Delphi 5?


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Stephen Bertram
Sent: Wednesday, 28 May 2003 8:53 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: ADO funny


Hi All

A strange occurrence which I am unable to explain, but I feel that I have
seen before.  This is with Delphi 5 and SQL Server 2000.

We have a thread which updates a SQL Server database via a stored procedure
when monitored data in the application is changed or added.  The thread
instantiates its own TADOConnection and a TADOStoredProc.  As changed data
is detected the TADOStoredproc's parameters are updated and the ExecProc
method called. The purpose of the thread is to pipeline database updates
from the 20 - 500+ execution threads handling client processes.

On one machine (Windows Server 2000) the second time the ExecProc method is
called the application vanishes - no errors, no Dr Watson.  On all other
machines we run it on the application behaves beautifully.  The failure
occurs with only 12 active threads, so it does not seem to be load related
as the application happily runs in the real world with over 1500 threads.

The fix has been to instantiate the TADOStoredProc for every database update
and then free it.  While this works it is not elegant and as it may run up
to 100 times a second the inefficiency is a problem.

Any ideas what may be the cause, either from the ADO components or the
Windows 200 Server environment?

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
Disclaimer : This communication contains information that is confidential and the 
copyright of enSynergy Limited or a third party. If you are not the intended recipient 
of this communication please delete and destroy all copies and telephone enSynergy 
Limited on +64 9 9205441 immediately. If you are the intended recipient of this 
communication you should not copy, disclose or distribute this communication without 
the authority of enSynergy Limited. Any views expressed in this Communication are 
those of the individual sender, except where the sender specifically states them to be 
the views of enSynergy Limited. Except as required by law, enSynergy Limited does not 
represent, warrant and/or guarantee that the integrity of this communication has been 
maintained nor that the communication is free of errors, virus, interception or 
interference.

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


[DUG]: Printing Barcodes

2003-02-12 Thread Stephen Bertram
Hi All

What is the easiest method to create barcode labels from Delphi?

Cheers

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Smaller EXE's part 2

2003-01-19 Thread Stephen Bertram
Title: Message



We use 
UPX to compress our Delphi apps as we deploy via the web - to date we have had 
no problems at all..

HTH

Stephen


  Original Message-From: Jeremy Coulter 
  [mailto:[EMAIL PROTECTED]]Sent: Monday, 20 January 2003 8:13 
  a.m.To: Multiple recipients of list delphiSubject: 
  [DUG]: Smaller EXE's part 2
  Hi 
  again.
  Has anyone used 
  UPX "Ultimite something or other" that shrinks EXE sizes?
  If you have used 
  it, have you experienced any problems?
  
  Cheers,
  
  Jeremy 
  Coulter
  
  
  
  All email scanned with Nortons 
  Antivurus 2002
  
  


[DUG]: ADO question

2002-12-05 Thread Stephen Bertram
Hi all

I know I have seen this before and fixed it, but I can't remember how.  This is 
connecting to Ingres via ODBC with a TADOConnection. The failure is on a simple select 
statement.

  Error message : The requested operation cannot be performed with active queries

There are no current transactions and the ODBC connection dies immediately after this. 
 The statement it occurs on is run many times and fails consistently only after 
another procedure runs.  While I know there must be an issue in the other procedure I 
can't fault it by inspection (mainly because I don't know what I'm looking for).

Can anyone point me at the likely root cause?

TIA 

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Testing for existence of TStringList

2002-11-13 Thread Stephen Bertram
if Assigned(MyStringList) then
  .

-Original Message-
From: Mark Howard [mailto:mhoward;pslog.co.nz]
Sent: Thursday, 14 November 2002 11:37 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Testing for existence of TStringList


Hi 

Sorry.  Basic question.

How do you test for the existence of a TStringList 
(for example) before reading from it - or do you just 
do a try...except?

Mark
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



[DUG]: TADOQuery performance

2002-11-11 Thread Stephen Bertram
I am struggling with the performance of TADOQuery on one machine.

Running a stored procedure that returns around 1 rows it takes 10.5 seconds to 
iterate though the rows:
  while not qry.Eof do
qry.Next;

On investigation I found that then SQL ran in 0.8 seconds, the first 1000 rows were 
read in 120 mSec, but each successive 1 rows took longer to navigate:
  1 0.120 sec
  2 0.290 sec
  3 0.461 sec
  4 0.681 sec
  5 0.801 sec
  6 0.992 sec
  7 1.081 sec
  8 1.202 sec
  9 1.332 sec
 10 1.522 sec

This result was not affected by any combination of CursorLocation, Cursor Type or 
LockType.  This same procedure runs in under a second on other machines.

Does anyone have any pointers for the environment, settings or anything else that may 
help? 

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: TADOQuery performance

2002-11-11 Thread Stephen Bertram
I forgot to mention that we are connecting to SQL Server 2000

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: RE: [DUG]: TADOQuery performance

2002-11-11 Thread Stephen Bertram
Hi Myles

The machine has 50 Mb of Ram with the current usage at 132 Mb.

The point is that the times AREN'T cumulative - each time is the time to iterate 
through 1000 rows.  It suggests that the Dataset is reading the rowset from row 1 each 
time the qry.Next is executed. ie = no cursor.

Any thoughts?

Stephen

-Original Message-
From: Myles Penlington [mailto:myles;ams.co.nz]
Sent: Tuesday, 12 November 2002 5:08 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: TADOQuery performance


Unless I am reading your results wrong (maybe?), it seems it takes about
150ms on average to read each set of 1 rows. Results seem quite linear.

Presuming you have a problem, and it seems the machine is the issue, then
how much memory does it have - is it paging/thrashing a lot? What about the
ADO version installed on the machine? Are they all the same eg MDAC 2.5, 2.6
or 2.7 etc.

A slower CPU or perhaps it is getting network errors? Although you seem to
hint that network is working okay.

Myles.


-Original Message-
From: Stephen Bertram [mailto:StephenB;ensynergy.co.nz]
Sent: Tuesday, 12 November 2002 4:55 p.m.
To: Multiple recipients of list delphi
Subject: [DUG]: TADOQuery performance


I am struggling with the performance of TADOQuery on one machine.

Running a stored procedure that returns around 1 rows it takes 10.5
seconds to iterate though the rows:
  while not qry.Eof do
qry.Next;

On investigation I found that then SQL ran in 0.8 seconds, the first 1000
rows were read in 120 mSec, but each successive 1 rows took longer to
navigate:
  1 0.120 sec
  2 0.290 sec
  3 0.461 sec
  4 0.681 sec
  5 0.801 sec
  6 0.992 sec
  7 1.081 sec
  8 1.202 sec
  9 1.332 sec
 10 1.522 sec

This result was not affected by any combination of CursorLocation, Cursor
Type or LockType.  This same procedure runs in under a second on other
machines.

Does anyone have any pointers for the environment, settings or anything else
that may help? 

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



Re: [DUG]: TADOQuery performance

2002-11-11 Thread Stephen Bertram
Other data:

MDAC 2.6
CPU 600Mhz
Network 100Mbps

Stephen


-Original Message-
From: Myles Penlington [mailto:myles;ams.co.nz]
Sent: Tuesday, 12 November 2002 5:08 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: TADOQuery performance


Unless I am reading your results wrong (maybe?), it seems it takes about
150ms on average to read each set of 1 rows. Results seem quite linear.

Presuming you have a problem, and it seems the machine is the issue, then
how much memory does it have - is it paging/thrashing a lot? What about the
ADO version installed on the machine? Are they all the same eg MDAC 2.5, 2.6
or 2.7 etc.

A slower CPU or perhaps it is getting network errors? Although you seem to
hint that network is working okay.

Myles.


-Original Message-
From: Stephen Bertram [mailto:StephenB;ensynergy.co.nz]
Sent: Tuesday, 12 November 2002 4:55 p.m.
To: Multiple recipients of list delphi
Subject: [DUG]: TADOQuery performance


I am struggling with the performance of TADOQuery on one machine.

Running a stored procedure that returns around 1 rows it takes 10.5
seconds to iterate though the rows:
  while not qry.Eof do
qry.Next;

On investigation I found that then SQL ran in 0.8 seconds, the first 1000
rows were read in 120 mSec, but each successive 1 rows took longer to
navigate:
  1 0.120 sec
  2 0.290 sec
  3 0.461 sec
  4 0.681 sec
  5 0.801 sec
  6 0.992 sec
  7 1.081 sec
  8 1.202 sec
  9 1.332 sec
 10 1.522 sec

This result was not affected by any combination of CursorLocation, Cursor
Type or LockType.  This same procedure runs in under a second on other
machines.

Does anyone have any pointers for the environment, settings or anything else
that may help? 

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Friday Challange

2002-10-31 Thread Stephen Bertram



I've 
done this in 5 different ways. One of the moreflexible 
is


function statement(Sep, Quote: String): string;
var
 I: integer;
begin
 Result := Sep;
 for I := 0 to pred(ItemCount) 
do
 Result 
:=format('%s%s%s%s%s',[Result,Sep,Quote,Item[I],Quote])
 
Delete(Result, 1, Length(Sep);
end;

The 
main advantage of this is speed where the list is large - the conditional is 
removed from the iteration. 
(Note 
that many variants of SQL limit the number of parameters in a list to 255 and 
the length of the list to 2000 or 4000.)

One of 
our standard method for comma separated lists is to use a stringlist (not 
efficient but simple and avoids empty lists):


function statement(FieldName, EmptyCondition: String; Quote: 
Boolean): string;
var
 i integer;
ResList : TStringList;
begin
 ResList :=TStringList.Create; 
 for I := 0 to pred(ItemCount) 
do
 if Quote
  ResList.Add(Format('''%s''',[Item[i]]))
 else
 
ResList.Add(Item[i]);
 
if ResList.Count  0 then
 
 Result := Format('%s in (%s)',[FieldName, 
ResList.CommaText]
 
else
 Result := 
EmptyCondition;
 
ResList.Free;
end;

Result:= $0.02;
Stephen

  -Original Message-From: Neven MacEwan 
  [mailto:[EMAIL PROTECTED]]Sent: Friday, 1 November 2002 12:28 
  a.m.To: Multiple recipients of list delphiSubject: 
  [DUG]: Friday Challange
  Hi all,
  
  Further to my enpty string question, I'm writing 
  a lot of
  functions that return a set of strings joined by 
  a separator
  ie 'col1, col2,...' or 'col1 = 'a' and colb = 
  'b'' (as you may guess
  these are all parts of SQL 
  Statements)
  
  given a function'Itemcount'that 
  returns the number of items
  and item(i) that returns the item string, and 
  function sep what is the
  best form of such a function
  
  to seed the duscussion I'll give you one of my 
  variants
  
  function statement: string;
  var
   I: integer;
  begin
   Result := '';
   for I := 0 to pred(ItemCount) 
  do
   if I = 0then Result := 
  Item(I)
   else Result := 
  format('%s%s%s',[Result,Sep,Item(I)])
  end;
  
  Variants and explainations pls
  
  Neven
  


[DUG]: Controlling conditional help

2002-10-30 Thread Stephen Bertram
Title: Controlling conditional help






Has anyone used conditional help files controlled from a Delphi applications?


We have written HTML help files that include various sections that are only visible to the users if certain system switches are set. I can include or hide these sections by setting cookies and this works well. These help files are accessed from Delphi 5 using hh.pas from The Helpware Group. 

However I haven't yet sorted out how to control the cookies on the local machine from the Delphi app.


Any pointers??


Stephen





[DUG]: Style question - your votes please

2002-10-30 Thread Stephen Bertram



We're having a quiet 
(NOT) discussion about the PCness of the following code:

function 
FindFirstMatch (List: TItemList; Status: TItemStatus): 
Integer;
begin
 for Result := 
0 to List.Count - 1 do
 
if List[Result].Status = Status then
 
Exit;
 Result := 
-1;
end;

The main objection 
is the use of Exit, but the only simple way I can see to write around that is to 
add a local variable:


function FindFirstMatch (List: TItemList; Status: 
TItemStatus): Integer;
var
 
i: Integer;
begin
 
Result := -1;
 
fori := 0 to List.Count - 1 do
 if List[Result].Status = Status 
then
 begin
 Result:= 
i;
 
Break;
 end;
end;

Which 
is preferable or what is a tidier method?

Stephen


RE: [DUG]: weird behavour with Format

2002-08-27 Thread Stephen Bertram



Hi 
Paul

Your 
code works fine within and without the "with" in Delphi 5 
here.
Stephen

  -Original Message-From: Paul McKenzie 
  [mailto:[EMAIL PROTECTED]]Sent: Wednesday, 28 August 2002 10:18 
  a.m.To: Multiple recipients of list delphiSubject: 
  [DUG]: weird behavour with Format
  I have struck some weird behaviour:
  
  We use "Format" to format SQL Strings - this 
  usuallyworks (has so far, used three times) ...
  The following code will not work if contained 
  inside the "with" statement - and it is only setting a local variable 
  !!!
  I can't see or understand why ?
  I have the same constructs in other parts of my 
  code - all working fine
  - I have checkedthe TIBQueries, 
  theyare identical apart from SQLString, SQLParameters, and 
  Name.
  - I even copied 1 across and used it - same 
  result!
  This should not affect the assigning of a local 
  variable ...
  
  I am avoiding the "with" (it all works) but I 
  would love to know why and if anyone else has come across this ?
  
  procedure MyProcedure ...
  const csString = 'This is an 
  example string ' 
  +'this%s 
  string ' 
  +'is 
  a test';var TestString: String;
  ResultString: 
  String;
  beginTestString := 'Blah 
  Blah Blah; with qryMyQuery do begin 
  ResultString := Format(csString, [TestString]); // Inserts '' 
  end; ResultString := Format(csString, [TestString]); // 
  Inserts 'Blah Blah Blah'end;
  
  
  RegardsPaul McKenzieAnalyst 
  ProgrammerSMSS Ltd.


RE: RE: [DUG]: 24/7 application design

2002-08-26 Thread Stephen Bertram

Just shows that we should sit back and let Borland look after the housekeeping :)

Stephen

-Original Message-
From: Ben Taylor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 27 August 2002 2:23 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: 24/7 application design


hi!

thanks for the reply.. i've done some tests, and decided that (for now)
there isnt much benefit from pooling objects (its not like i'm pooling
db connections).

i did write a pooling component that took care of being thread safe,
limits on how many components could be created etc.. it also required
that all pooled objects implement an init/shutdown interface to take
care of resetting properties etc. worked well, but in the end the tests
showed it wasnt necessary.

btw, the tests were just creating/freeing large numbers of objects
(10-100mil), seeing if there was any effect on the application (eg
gradual decrease in performance etc..) all seemed fine, which was..
reassuring.. :-)

thanks,
ben.

--- Stephen Bertram [EMAIL PROTECTED] wrote:
 This is an area where I have never found one answer solves all.
 
 The main thing to watch is memory leaks - we use Sleuth Codewatch and
 it has saved us a couple of times.
 
 With multithreading you have to add critical sections and inuse
 flags.  If the ojects are shortuse you can envelope the acquire-drop
 in one critical section, but normally you have to give the acquire
 function the ability to instantiate extra copies if necessary.
 
 The simplest way I have found is to write the pooling into the
 object itself by overwriting the Create and Free methods to maintain
 an instantiated object in a unit variable. This  involves minimal
 additional code and means that you can add the additional
 functionality at any time without affecting the code in the rest of
 the application.  It also makes it easier to do side by side tests to
 see the result of maintaining a static copy of a particular object.
 
 Just make sure that the Create method resets all properties to
 default and calls any OnCreate events.
 
 Stephen


__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: 24/7 application design

2002-08-25 Thread Stephen Bertram

This is an area where I have never found one answer solves all.

The main thing to watch is memory leaks - we use Sleuth Codewatch and it has saved us 
a couple of times.

With multithreading you have to add critical sections and inuse flags.  If the ojects 
are shortuse you can envelope the acquire-drop in one critical section, but normally 
you have to give the acquire function the ability to instantiate extra copies if 
necessary.

The simplest way I have found is to write the pooling into the object itself by 
overwriting the Create and Free methods to maintain an instantiated object in a unit 
variable. This  involves minimal additional code and means that you can add the 
additional functionality at any time without affecting the code in the rest of the 
application.  It also makes it easier to do side by side tests to see the result of 
maintaining a static copy of a particular object.

Just make sure that the Create method resets all properties to default and calls any 
OnCreate events.

Stephen

-Original Message-
From: Ben Taylor [mailto:[EMAIL PROTECTED]]
Sent: Friday, 23 August 2002 10:38 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: 24/7 application design


hi,

does anyone have thoughts/experience on apps that run 24/7, creating /
destroying around 20 objects/sec (different classes). i'm wondering if
i should take the time to implement a component pool (eg
aObj:=pool.acquire(TmyComp) ), which would eliminate the memory
churn/fragmentation i'm concerned about. however this does increase
complexity/ chances of bugs etc..

the other alternative is that i change to a more static design, but
from a design point of view i dont want to do that.. :-)

i'll be running a test at some point, but it could take a week or 2 to
get my answer :-)

comments?

thanks,
ben
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Renaming Folders in Windows

2001-10-14 Thread Stephen Bertram

Doesn't RenameFile() cover this ?

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Treeview with checkboxes

2001-10-03 Thread Stephen Bertram

We've used the Dream Tree components successfully. ($US29 for full version)

http://www.dreamcompany.com/

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Update SQL Syntax

2001-10-01 Thread Stephen Bertram

From memory I think for MSSQL you should use a format like:

UPDATE a
SET Department = b.Department
FROM SHDayD a, Product b
WHERE a.ScanCode = b.ScanCode

HTH

Stephen

-Original Message-
From: David Brennan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 2 October 2001 10:41 a.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Update SQL Syntax

 What is the syntax for an update query if I want to reference another
table
 ?

 I.E

 UPDATE SHDayD
 SET Department = Product.Department
 WHERE (ScanCode = Product.ScanCode)

Depends a bit on which version of SQL you are using but the following would
work on SQL Server:

UPDATE SHDayD
SET Department = Product.Department
FROM Product
WHERE (SHDayD.ScanCode = Product.ScanCode)

David.

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



[DUG]: Monitoring the state of a database with TADOConnection

2001-09-18 Thread Stephen Bertram

Hi

I have an application using ADO that needs to monitor the availability of a
SQL7 / 2000 database.  If the connection is lost the connection needs to be
reestablished as soon as the database is available.

At present the Connected status does not change when the connection is lost.


Can anyone point me to a reliable method to achieve this?

TIA

Stephen

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Interbase X SQL Server

2001-09-12 Thread Stephen Bertram

Hi Paul

I've only seen this where the application is threaded and then it can be
solved (BDE) by giving each thread an independent session.

As to the date format error, check the ShortDateFormat.  You may have to
coerce the date into a dd-mmm- or mmdd format.  SQL 7 is set up by
default for American date formats, but I have found that 'MMDD HH:MM:SS'
appears to work regardless of the SQL 7  settings.

Stephen


-Original Message-
From: Paul Mostek [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 13 September 2001 9:24 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Interbase X SQL Server


Hello all,
   This is my debut in [EMAIL PROTECTED] !  
   Although the yesterday disaster, I have to work...
   And unfortunately I have a very serious problem on
my work:

   I work maintaining and raising a big system
developed in Delphi 4 Client/Server.
This system was made by another person to work with an
Interbase 5.1.1 Server.
With Interbase, the system works superbly. But due to
politics reasons, my boss is demanding me 
to use MS SQL Server 7...
   My problem begins at this point. The system was
designed with several TQueries with the 
RequestLive property set to TRUE.
   There are numerous TQueries e DBGrids attached to
those TQueries. The data handling is made 
entirely through the DBGrids (insertion, deletion,
update).
   When the system is running over MS SQL Server 7 the
following error happens : 
  Key Violation
   General SQL error.
   [Microsoft][ODBC SQL Server Driver] Connection
is busy with results for another hstmt.
   This error is intermittent: sometimes happens,
sometimes doesn4t happens.

   I4ve searched for this error message in the
Microsoft TechNet and found a brief explanation in 
http://support.microsoft.com/support/kb/articles/Q143/0/32.asp.
They say, the following:
 After you execute an asynchronous query you
cannot access the recordset or execute another 
asynchronous query on the same RdoConnection until the
StillExecuting property of the recordset 
is False. This behavior is by design.
 Well, Microsoft obviously is referring to a
Visual Basic point of view when talk about 
StillExecuting. And I4m absolutely sure that there are
not concurrent queries being executed in 
the system.
 Surely the error happens when opening a query
with RequestLive=True. Then me and my 
development team are transforming drastically the
system to eliminate the use of 
RequestLive=True.
 But, as the system is very huge, the amount of
effort is enormous. Then I4ve tried to access 
the MS SQL Server 7 through a MSSQL native driver in
BDE, instead of use ODBC. Unexpectedly 
another kind of error happens:  
General SQL error.
 Syntax error converting datetime from
character string.
 The most weird thing is that this error happens
even when I am altering data on the SQL 
Explorer 4.
 Then I4ve only changed from an error to
another...
 I4ve sent the command SET DATEFORMAT DMY do MS
SQL Server, but the problem continues.

  
 Do you have some idea to solve this problem ?
 Do you have some alternative to avoid the hard
task of modifing the whole system ?

 Thanks a lot.
 Forgive-me whether I was very prolix...

Paul Mostek



---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: [Q] Component Questions

2001-09-06 Thread Stephen Bertram



If you 
have written TMyBaseComponent change it to :

TMyBaseComponent = 
class(TComponent)private FMyProp : string; 
FOnMyEvent : TNotifyEvent;
protected
 procedure 
SetMyProp(Value: string); virtual;
published property MyProp : string read 
FMyProp write SetMyProp; property 
OnMyEvent : TNotifyEvent read FOnMyEvent write 
FOnMyEvent;end;TMyDescendantComponent = 
class(TMyBaseComponent)protected
 
procedure SetMyProp(Value: string); override; // 
Remember to call the inherited method 
 
...
end;

This allows you to hook any changes to MyProp in 
TMyDescendantComponent 

There are several methods to intercept calls to OnMyEventbut 
I'll leave it to the experts to provide an elegant solution 
:-)

Stephen-Original Message-From: Donovan J. Edye 
[mailto:[EMAIL PROTECTED]]Sent: Friday, 7 September 2001 11:23 
a.m.To: Multiple recipients of list delphiSubject: [DUG]: 
[Q] Component Questions
G'Day All,If I have 
  something like:TMyBaseComponent = 
  class(TComponent)private FMyProp : string; 
  FOnMyEvent : TNotifyEvent;published property MyProp : 
  string read FMyProp write FMyProp; property OnMyEvent : 
  TNotifyEvent read FOnMyEvent write 
  FOnMyEvent;end;TMyDescendantComponent = 
  class(TMyBaseComponent)How do you elegantly in the 
  descendant:1. Determine when MyProp is changed so that 
  TMyDescendantComponent can take some specialised action2. Determine when 
  OnMyEvent is fired so that TMyDescendantComponent can take some specialised 
  actionTIA
  -- 
  Donovan 
  -- 
  Donovan J. Edye [www.edye.wattle.id.au] 
  Namadgi Systems [www.namsys.com.au] 
  Voice: +61 2 6285-3460 Fax: +61 2 6285-3459 TVisualBasic = 
  Class(None); Heard just before the 'Big Bang': "...Uh Oh" 
  -- 
  GXExplorer [http://www.gxexplorer.org] 
  Freeware Windows Explorer replacement. Also includes freeware delphi 
  windows explorer components. 
  --


RE: [DUG]: Unknown error

2001-08-03 Thread Stephen Bertram

Thanks Myles - that is exactly the lead I need.

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



[DUG]: Unknown error

2001-08-02 Thread Stephen Bertram

Can anyone interpret the following error. It is occurring on program exit
and may relate to a hanging thread.

Unknown exception (0x0eedfade) at ...

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Unknown error

2001-08-02 Thread Stephen Bertram

Hi Andrew

Thanks for the context - we're using the Indy TCP Sockets components so it
may be a TCP error ???

STephen

-Original Message-
From: Cooke, Andrew [mailto:[EMAIL PROTECTED]]
Sent: Friday, 3 August 2001 9:22 a.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Unknown error


We get this one quite often if we've used something related to internet
explorer in our apps (eg, WinINet, or HTML Help). My gut feeling was also
that it was thread related, even if our apps don't explicitly use threads.
Happens to us on program exit under Win2000.
So no help, but shared frustration.
  Andrew Cooke.

-Original Message-
From: Stephen Bertram [mailto:[EMAIL PROTECTED]]
Sent: Friday, 3 August 2001 9:09 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Unknown error


Can anyone interpret the following error. It is occurring on program exit
and may relate to a hanging thread.

Unknown exception (0x0eedfade) at ...

TIA

Stephen


Attention:
The information contained in this message and or attachments is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material.  Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited.  If you have received this message in error, please notify
the sender immediately.
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Sets of Strings?

2001-08-01 Thread Stephen Bertram

Hi Ross

A bit naf in the OO world, but an old trick to avoid declaring a StringList
is to add an identifier to your search string.  ie

  IsAudio := (pos(Extension + '@', '.wav@.mp3@.ogg@'));

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Sets of Strings? - Correction

2001-08-01 Thread Stephen Bertram


That should have been 

  IsAudio := (pos(Extension + '@', '.wav@.mp3@.ogg@')  0);

:-(

Stephen


---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



[DUG]: How to read .MAP file??

2001-07-30 Thread Stephen Bertram

I have a multi-threaded application that is throwing errors (only in the
runtime environment) in the form of 

The instruction at 0x004fd936 referenced memory at 0x00018.  The
memory could not be read

How do I locate the source of the problem using the .map file (or any other
method)? 

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



[DUG]: Indy TCP Server

2001-07-23 Thread Stephen Bertram

Hi All

If anyone can tell me how to access the number of active connections using
TIdTCPServer I would appreciate it.

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Destroying Objects

2001-07-18 Thread Stephen Bertram

From bitter experience with W95 I am certain that Windows does not clean up
memory that has been left hanging by a Delphi App.  To a large extent this
is due to the hands-off that windows adopts to allow spawned threads to
continue running after the spawning application has completed I believe. 

Stephen


-Original Message-
From: Steve Aish [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 19 July 2001 2:53 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Destroying Objects


IME Windows 9x and Windows 2000 do not free all resources when an
application exits - or at least not if a program crashes.

e.g. If I am debugging a program I am running and get into an endless loop
and go CTRL-F2 to quit the programming, after doing this a couple of times
my machine says Nope had enough - no memory left - Please reboot me.
(Rough translation from Windowese) - even if I close Delphi and have nothing
left open, nothing else will run.  No resources left.

From this I can gather that either Delphi has issues with releasing it's
memory or Windows has an issue.

Steve

-Original Message-
From: Chrissy R [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 19 July 2001 14:35
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Destroying Objects


When I read the original question I read it was asking When the application
closes is all allocated memory released?  Reading the answers, it appears
that what most people read it was While and application is still running,
and an object is destroyed, are the objects owned/parented by this object
also destroyed?

These are two totally different questions.  I would hope that the answer
to the first is yes and would imagine that the answer to the second is
sometimes - it depends on circumstances.

Please tell me if I am wrong.

Chrissy.

- Original Message -
From: Alex Kouznetsov [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, July 19, 2001 2:09 PM
Subject: Re: [DUG]: Destroying Objects


 I have had an impression that with latest versions of Windows, when an
 application exits, absolutelly all the memory it has allocated is freed by
 OS.

 Alex

 - Original Message -
 From: Sergei Stenkov [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Thursday, 19 July 2001 10:36
 Subject: RE: [DUG]: Destroying Objects


  Ross,
 
   When an application exits in the normal way, does it automatically
   destroy all objects created at runtime?
 
  No. You'll need to take care of them
 
  var
Obj: TObject;
  begin
Obj := TObject.Create;
try
 
  // do what you need
 
finally
  Obj.Free;
end;
  end;
 
  Cheers,
  Sergei Stenkov

 --
 -
  New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
  To UnSub, send email to: [EMAIL PROTECTED]
  with body of unsubscribe delphi
  Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
 

 --
-
 New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
   Website: http://www.delphi.org.nz
 To UnSub, send email to: [EMAIL PROTECTED]
 with body of unsubscribe delphi
 Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: How to approach this?

2001-07-15 Thread Stephen Bertram



Hi 
Donovan

I 
assume you are trying to normalise out common data. 

Question 1
The 
simplest way is as a TStringList if the Player IDs are not contiguous - thsi 
handles non-existant IDs and a lot of hastles. If the IDs are a contiguous 
list and will always exist you can use an array of string.

Question 2
My 
main comment is that I woulduse a unique marker or tag to mark the start 
and end of insert points. Choose a pair of ASCII constants  32 such as 
STX/ETX or if they must be printable use '' '' or '[' ']' - 
anything that will not occur in normal use.

Somthing like 

Var
 
s : String;
 
StartPos, EndPos, TagValue : Integer;
 
Players : TStringList;
Const
 
StartMarker = '[';
 
EndMarker = ']';
begin

 
.
 
while pos(StartMarker, s)  0 do
 
begin
 StartPos := pos(StartMarker, 
s);
 EndPos := pos(EndMarker, 
s);
 if EndPos = 0 
then // Skip if markers unbalanced
 Exit; 

TagValue := StrToIntDef(Copy(s, StartPos + Length(StartMarker), 
(EndPos- StartPos -Length(StartMarker)), -1);
 
if TagValue = -1 then // Skip is not a valid 
tag
 
Exit;
 Delete(s, StartPos, (EndPos - Start 
Pos + Length(EndMarker));
 
Insert(Players.Values[IntToStr(TagValue)], s, StartPos);
 
end;
 
..
 
Result := s;
end;

EOE :)
Stephen
-Original Message-From: Donovan 
J. Edye [mailto:[EMAIL PROTECTED]]Sent: Friday, 13 July 2001 5:12 
p.m.To: Multiple recipients of list delphiSubject: [DUG]: 
How to approach this?
All,I have to do the 
  following:- Replace some numeric integers with string values in a 
  string- The position of the integers the string may vary- It all has 
  to be as fast as possibleWhat we have are some paradox tables with the 
  following format: (TPlayerID : integer)TableAPlayerID : 
  TPlayerIDFirstName : string;SecondName : 
  string;TableBBatsmanID : TPlayerIDBowlerID : 
  TPlayerIDField1 Field2Field3OtherBatsmanID : 
  TPlayerIDField4etc.Assume we have the following TPlayerID - 
  TPlayerCode mappings. TPlayerCode : string[5]1 - ABCDE2 - 
  FGHIJ3 - MNOPQetc.If we get strings as follows - say read 
  from a text file:PlayerID, FirstName, 
  SecondName3,John,DoeBatsmanID, BowlerID, Field1, Field2, Field3, 
  OtherBatsmanID, Field41,3,a,b,c,2,ePlayerID, FirstName, 
  SecondName1,Paul,SmithBatsmanID, BowlerID, Field1, Field2, Field3, 
  OtherBatsmanID, Field42,1,a,b,c,3,eQuestion 1:- What is 
  the most efficient way to store the TPlayerID, TPlayerCode as a memory 
  structure mappings so that: - Minimal memory 
  footprint - Fastest searchingThe above 
  mappings list does not generally change a lot. So "slow" creation of the 
  mapping list is not a big concern. Typically the mapping list is created once 
  and accessed many. It is nominally read only.Question 2:- What 
  is the most efficient way to replace a specific string with another? So 
  given:BatsmanID, BowlerID, Field1, Field2, Field3, OtherBatsmanID, 
  Field41,3,a,b,c,2,eEnd up withBatsmanID, BowlerID, Field1, 
  Field2, Field3, OtherBatsmanID, 
  Field4ABCDE,MNOPQ,a,b,c,FGHIJ,eComments, suggestions welcome. 
  TIA
  -- 
  Donovan 
  -- 
  Donovan J. Edye [www.edye.wattle.id.au] 
  Namadgi Systems [www.namsys.com.au] 
  Voice: +61 2 6285-3460 Fax: +61 2 6285-3459 TVisualBasic = 
  Class(None); Heard just before the 'Big Bang': "...Uh Oh" 
  -- 
  GXExplorer [http://www.gxexplorer.org] 
  Freeware Windows Explorer replacement. Also includes freeware delphi 
  windows explorer components. 
  --


[DUG]: Using Dates in ClientDataset Filters

2001-07-04 Thread Stephen Bertram

What is a method of specifying a date in a filter string for a ClientDataset
that is independent of the local ShortDateFormat ?

Obviously 'DateField = ''' + DateToStr(TargetDate) +   does not work.
Nor does 'DateField = ' +  FloatToStr(TargetDate).

Is there a date format that can be used safely?  
  eg 'DateField = ''' +  FormatDateTime('MMDD', TargetDate) + 

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi



RE: [DUG]: Performance Issue

2001-07-03 Thread Stephen Bertram

You might like to quess the answer to the following question.

Given:

var
  StrArray : Array of String;
  x : String;
const
  FS = #29;

Routine 1

  for i := 0 to high(StrArray) do
x := x + StrArray[i] + FS;

Routine 2

  for i := 0 to high(StrArray) do
  begin
x := x + StrArray[i];
x := x + FS;
  end;

What are the relative times for Routine 1 and Routine 2 for StrArray being :
a. 10,000 Strings of 200 characters
b. 100,000 Strings of 200 characters
c. 1,000,000 Strings of 20 characters

The closest guess gets a virtual chocolate fish - no coding allowed :-)

When you've worked it out - could someone explain this in simple terms ?

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi



[DUG]: Registry access with Windows 95

2001-06-21 Thread Stephen Bertram

Can anyone tell me why this fails with Win 95 and what I can do about it?
Works fine in Win 2000.

  with TRegistry.Create do 
  begin
RootKey := HKEY_CURRENT_USER;
if OpenKey('\Software\packageX\anExistingEntry', False) then
try
  try
if ValueExists(Value) then
begin
  Res := ReadInteger(Value);
  Result := True;
end;
  except
  end;
finally
  Free;
end
else
  Free;
  end;

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi



RE: [DUG]: Dates On NT4

2001-06-14 Thread Stephen Bertram

I would suspect it isn't NT4, but the users date format setting.

We have had many problems communicating dates reliably between different
machines and now tend to use FloatToStr(DateTimeVar) which gives an ASCII
floating point number which can be read as DateTimeVar =
StrToFloat(ASCII_Value)

Be careful though - Delphi's TDateTime are based on 0 = 1/1/1900 while some
SQL databases (MSSQL...) use 0 = 30/12/1899  !

HTH

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi



RE: [DUG]: help formats.

2001-05-17 Thread Stephen Bertram

HTML Help Kit for Delphi
http://www.helpware.net

We use this in all our apps. Simple and free.

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi



RE: [DUG]: Really simple question(s): Navigating Source Code Shortcuts

2001-05-13 Thread Stephen Bertram

1.  Ctrl-Shift-UP/DOWN
2.  Ctrl-Shift-C  - Generates all procedure wrappers for the current object.
Even better will implement a field and setter procedure for a property
declaration.

   e.g. Type property xyz: String;  and press Ctrl-Shift-C 

Stephen 
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi



RE: [DUG]: Simple email data transfer

2001-05-13 Thread Stephen Bertram



Hi 
Collin

If 
both PC's are visible via the internet I would use a simple TCP/IP socket 
transfer. It is simple to program, robust and flexible. There is no 
limit to the number of machines that can access the remote machine(s) and 
transfer can be scheduled or on demand.

If you 
want a simple example see the Delphi Chat demo, though there are also several 
third party components which can do more.

HTH

Stephen


  -Original Message-From: Colin Dillicar 
  [mailto:[EMAIL PROTECTED]]Sent: Monday, 14 May 2001 1:20 
  p.m.To: Multiple recipients of list delphiSubject: 
  [DUG]: Simple email data transfer
  Hi all,
  
  For a remote monitoring application I need to 
  transfer a small amount (1-2k) of binary data between two computers from time 
  to time. I seem to remember another DUG member doing a similar thing but 
  cannot find the reference.
  
  I suspect that the solution involved using a MIME 
  e-mail transfer in either direction. In one instance I would need to email the 
  remote PC and have it respond with the data I require, dependant on the nature 
  of a command sent.In another case the remote PC would automatically send 
  data (randomly without a request) when a certain condition existed . 
  
  
  At either PC I therefore need a simple SMPT 
  program to send a message and a background POP3 task to detect an email from 
  the remote PC and make the data available. The PCs will need to 
  connectvia PSTN and ISP andthe WWW.
  
  I want to incorporate the above process into an 
  existing D3 program but don't want to re-invent the wheel.
  
  Please can anyone point me to suitable code or a 
  better/simpler method.
  
  Cheers
  
  [EMAIL PROTECTED]Colin R 
  DillicarAutomation Engineering 
Limited


RE: [DUG]: How to Do This

2001-04-05 Thread Stephen Bertram

Further to my earlier post I found some of the code I used to call functions
by name at runtime and have put this below.  The basic idea (and the bulk of
the code) for this was given to me by a C programmer.

If anyone has a neater way to access methods at runtime I would love to see
it.

Stephen

In the Application units
---
...
uses dispatch;
...
var
  Req : TStringList;
  LocalVariable : String;
...
  // To call a function - initialize the parameters and call CallFnc
  Req.Clear;
  Req.Add('Param1=XX');
  Req.Add('Param2=1');
  LocalVariable := CallFnc('FunctionName',Req);
...
initialization
  // Add all functions to the FnList
  FnList.AddObject('FunctionName=whatever ID you want to
use',@FunctionName);
end.


Function calling unit
 
unit dispatch;

interface

uses Classes, sysutils;

type
   TCallFn = function(req : TStringList) : string;

function CallFnc (FncName : string; Req : TStringList):string;

var
   FnList : tstringlist;

implementation

function CallFnc (FncName : string; Req : TStringList):string;
begin
   if Fnlist.indexofname(FncName) = -1 then
  Result := ' Function ' + FncName + ' not found '
   else
  Result :=  TCallFn (FnList.objects[
FnList.indexofname(FncName)])(Req);
end;

initialization
  FnList := TStringList.Create;
finalization
  FnList.Free;
end.
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: How to Do This

2001-04-05 Thread Stephen Bertram

That's much nicer than my method as you don't have to predetermine the
format of the parameters or remember to add them to the list.  I knew there
had to be a way but missed the  MethodAddress option.

Thanks 

Stephen

-Original Message-
From: Nahum Wild [mailto:[EMAIL PROTECTED]]
Sent: Friday, 6 April 2001 9:36 a.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: How to Do This


Well after a few minutes of finger bluring action last night I got it
working with MethodAccess.  I've included an example below -

{-}

type

  TMathOperation = function (const iVar1, iVar2 : integer) : integer of
object;

  TBasicMath = class(TObject)
  private
  protected
  public
class function Execute(const sOperation : string; const iVar1, iVar2 :
integer) : integer;

  published

function Add(const iVar1, iVar2 : integer) : integer;
function Subtract(const iVar1, iVar2 : integer) : integer;
function Multiply(const iVar1, iVar2 : integer) : integer;
function Divide(const iVar1, iVar2 : integer) : integer;

  end;

implementation

{$R *.DFM}

class function TBasicMath.Execute(const sOperation : string; const iVar1,
iVar2 : integer) : integer;
var
  ABasicMath : TBasicMath;
  AMathOp : TMathOperation;
  AMathMethod : TMethod;
begin

  ABasicMath := TBasicMath.Create;
  try

AMathMethod.Code := ABasicMath.MethodAddress(sOperation);
AMathMethod.Data := ABasicMath;
AMathOp := TMathOperation(AMathMethod);

assert(assigned(AMathOp));

Result := AMathOp(iVar1, iVar2)

  finally
ABasicMath.Free;
  end;

end;

function TBasicMath.Add(const iVar1, iVar2 : integer) : integer;
begin
  Result := iVar1 + iVar2;
end;

function TBasicMath.Subtract(const iVar1, iVar2 : integer) : integer;
begin
  Result := iVar1 - iVar2;
end;

function TBasicMath.Multiply(const iVar1, iVar2 : integer) : integer;
begin
  Result := iVar1 * iVar2;
end;

function TBasicMath.Divide(const iVar1, iVar2 : integer) : integer;
begin
  Result := iVar1 div iVar2;
end;

{-}

The usage for it would be something like this -

Edit1.Text := IntToStr(TBasicMath.Execute('Divide', 81, 9));


Hopefully its useful for someone.

Cheers,
Nahum.
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: How to Do This

2001-04-04 Thread Stephen Bertram

The simple way I found to do this was to set up a StringList with the name
of the function in the list and a pointer to the function in the Object
property.  

The problems were to populate the list at runtime and to have all the called
functions having common parameter lists and return types.  I used a
StringList as the input parameter as the app was a CGI which imported the
parameters that way and the type was string, though variant arrays can be
used for generality.

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: Debugging question

2001-03-26 Thread Stephen Bertram

One of my predecessors here added some hooks into SysUtils.pas.  The side
effect has been to make sysutils visible to the debugger and this can get
very annoying when stepping through a function call as you tend to spend
about 1 steps wading through the assembler lines dealing with string
comparisons.

What determines whether a unit is visible to the debugger?

TIA

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: d5 and win2k

2001-03-26 Thread Stephen Bertram

I installed a clean copy of D5 on Win2k Professional and then upgraded with
no problems.

The original files were timestamped 11/8/1999 5:00 a.m.

HTH

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Adding nodes to Treeview and dupicates

2001-03-06 Thread Stephen Bertram

As a quick thought try the following for the root nodes:

  if (TreeViewCompts.Items.Count = 0) then
begin
  {Add the root node}
  TreeViewCompts.Items.Clear; {remove any existing nodes}
  Node := TreeViewCompts.Items.Add( NIL ,Name); {Add
the root node}
end;


Stephen 
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: Using standard property editors

2001-02-18 Thread Stephen Bertram

I'm creating a customized menu system built from scratch, but generally
mirroring the VCL TMainMenu.  I want to use the standard VCL
TMenuItemProperty editor, but can't see how to declare it so it can be
registered.  

Can anyone give me an example to illustrate how to register the standard
property editor with my new component?

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Mucking with Controls.pas

2001-02-15 Thread Stephen Bertram

Hey - great ideas folks.  I did not realize you could expose private fields
via an interface on a decendent.  I'll give it a go later today.

Thanks

Stephen

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: Mucking with Controls.pas

2001-02-14 Thread Stephen Bertram

I have a need to add a couple of properties and an interface to all my
controls.  ATM I'm creating descendants and adding then to each class, but
it would be much neater to insert a new ancestor containing the properties
between TWinControl and TGraphicControl and TControl.

On a first attempt I ran into so much co-linkage through the standard
classes that I gave up the idea. However I would be interested to hear of
anyone who has done something similar or has some pointers on ways, means
and traps.

TIA

Stephen 

  
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Mucking with Controls.pas

2001-02-14 Thread Stephen Bertram

I know, I know, but it would save me 4000 lines of code (30 instances of the
same code) which all has to be updated every time I change anyting during
the implementation phase.  Adding as ancestor is sooo attractive  :-(

Thanks

Stephen

-Original Message-
From: GARY T BENNER [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 15 February 2001 12:49 p.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Mucking with Controls.pas


[Reply]

HI All,

Golden rule is not to mess with the VCL.

I guess the next best thing is to introduce the common attributes at the
first level of descendancy from a VCL ancestor. More work but safe.

kr

Gary

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Mucking with Controls.pas

2001-02-14 Thread Stephen Bertram

Yes - I'm already using an interface to propagate changes to all controls at
design time.  As yet I haven't figured out how to effectively to implement
methods by delegation where those methods refer to private fields.  

Any examples would be a help.

Cheers

Stephen


-Original Message-
From: Neven MacEwan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 15 February 2001 5:11 p.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Mucking with Controls.pas


Stephen

Rather than inserting an ancestor, why not define an interface
(this enforces implementation) and if there is a great level of
commonality you can implement it (the interface) by delegation in
your own 'subjobject' which is passed it's owner  (as the base class)
at construction, easy to implement, easy to use

HTH Neven

ie.

type
  TSubObject = class(Object, ImyInterface)
  private
 FWincontrol: TWinControl;
  public
constructor Create(AWinControl: TWinControl); overload;
  end;

  TmyControl = class(TWinControl, ImyInterface)
  private
 FSubObject: TSubObject;
  property
 SubObject: TSubObject read FSubObject write FSubObject implements
ImyInterface
  end







- Original Message -
From: Stephen Bertram [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, 15 February 2001 12:11
Subject: [DUG]: Mucking with Controls.pas


 I have a need to add a couple of properties and an interface to all my
 controls.  ATM I'm creating descendants and adding then to each class, but
 it would be much neater to insert a new ancestor containing the properties
 between TWinControl and TGraphicControl and TControl.

 On a first attempt I ran into so much co-linkage through the standard
 classes that I gave up the idea. However I would be interested to hear of
 anyone who has done something similar or has some pointers on ways, means
 and traps.

 TIA

 Stephen


 --
-
 New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
   Website: http://www.delphi.org.nz
 To UnSub, send email to: [EMAIL PROTECTED]
 with body of "unsubscribe delphi"


---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: Using Frames

2001-02-04 Thread Stephen Bertram

I'm using TFrame for the first time and expected it behave lie a TForm, but
have found a strange behaviour when trying to create multiple instances.

Basically TFrame.Create appears to create a phantom component "Frame" which
is a singleton.

Can anyone throw any light on this?

Stephen

-
Example:

type 
  TMyForm = class(TForm)
...
  end;

  TMyFrame = class(TFrame)
...
  end;
  ...
var 
  MyForm1 : TMyForm;
  MyForm2 : TMyForm;
  MyFrame1 : TMyFrame;
  MyFrame2 : TMyFrame;

implementation

procedure SetUp;
begin
  MyForm1 := TMyForm;
  MyForm2 := TMyForm;// This is OK
  MyFrame1 := TMyFrame;
  MyFrame2 := TMyFrame;  // This fails with "Component MyFrame already
exists".
  ...
end;
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Using Frames

2001-02-04 Thread Stephen Bertram

Woops - put editcheck mode into gear before posting!

Yes - what I meant was:
...
   MyForm1 := TMyForm.create(self);
   MyForm2 := TMyForm.create(self);// This is OK
   MyFrame1 := TMyFrame.create(self);
   MyFrame2 := TMyFrame.create(self);  // This fails with "Component MyFrame
already exists
...

And yes - this does appear only to occur when creating 2 instances of a
TFrame within a single form.  

I'm trying to create a persistant set of TFrames in a Page Control.  

The good news is that you are exactly right in suggesting that assigning a
unique name property solves the problem.  Thanks for the pointer, Carl.

Cheers

Stephen

-Original Message-
From: Carl Reynolds [mailto:[EMAIL PROTECTED]]
Sent: Monday, 5 February 2001 3:20 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Using Frames


From: Stephen Bertram [mailto:[EMAIL PROTECTED]]
 procedure SetUp;
 begin
   MyForm1 := TMyForm;
   MyForm2 := TMyForm;// This is OK
   MyFrame1 := TMyFrame;
   MyFrame2 := TMyFrame;  // This fails with "Component MyFrame
  already exists".

Presumably you meant "TMyForm.Create(...)" and "TMyFrame.Create(...)".  The
problem seems to be a conflict in the name, so try assigning a new name to
your first frame instance before creating your second, ie.

MyFrame1 := TMyFrame.Create(...);
MyFrame1.Name := 'MyFrame1';
MyFrame2 := TMyFrame.Create(...);
MyFrame2.Name := 'MyFrame2';

I'd further hazard a guess that this only happens when both frames are
created on the same form.

Cheers,
Carl
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: TTreeView

2001-02-01 Thread Stephen Bertram

Sorry - fired off the last reply without reading your post properly.  Just
use:

   ANode := TreeView.Items.Add(...);
   TreeView.selected := ANode;
or
   ANode.selected := True;
 
Stephen


-Original Message-
From: Chrissy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 1 February 2001 8:56 p.m.
To: Multiple recipients of list delphi
Subject: [DUG]: TTreeView


Hi,

How do I select the node that I have just added to the tree view?

Chrissy.

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: ADO woes

2001-01-24 Thread Stephen Bertram

I am struggling to get ADO working with WIN2000/SQL2000 Client and MSSQL7.0
server.  The problem surfaces mainly accessing stored procedures returning
more than 1 row.

Can anyone point me to any good papers on using the ADO components
effectively and any known problems?

Nice to have DUG back :-)

Cheers

Stephen

 application/ms-tnef


RE: [DUG]: D5 Help

2001-01-18 Thread Stephen Bertram

Thanks Moises

I think you're right on the button as I also have installed Multilizer.  I
have removed it from the help lists some time ago, but the problem remains.

Stephen


-Original Message-
From: Moises Lopez [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 18 January 2001 6:37 p.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: D5 Help


well, i also have had the same problem for quite a
while, so whenever i need a VCL component's help
check on the Contents tab  -- Visual component
Reference --alfabetical component list

actually i thought it was another components' help the
one that crashed the D5 help, i had installed
multilizer and infopower, and also the D5 help update
and SP1, and since the multilizer help is available i
supposed that was the culprit

but i havent had time to check it out...
mainly because i dont want to mess up my help at home
hehe

later..

Moises Lopez
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: D5 Help

2001-01-17 Thread Stephen Bertram

Thanks David

I tried clearing out all unnecessary help, but the main VCL components still
do not appear in the Index tab.  Not a total disaster, but I am trying to
teach Delphi to a graduate programmer and she is threatening to use VB :-( 

Cheers
Stephen

...I would try to use this to rebuild your Delphi help file (make a change
-
perhaps by removing and then adding back a help file - then select Save
Project). If this doesn't work then have a closer look at list of help
files
in the Index tab of OpenHelp. It should be quite long and include things
like the Visual Component Library help (del5vcl.hlp). If it doesn't or if
the paths are wrong then add to/fix the list.

You should also be aware that Windows 95, 98 (and possibly Windows Me)
can't
handle a large number of items in the index. So if you add too many things
to the Index you will probably find that you can't see anything when you
try
to view it.

HTH,
David Brennan.
DB Solutions Ltd.
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: [DUG-DB]: Unique IDs

2001-01-11 Thread Stephen Bertram

Neven

You are right in the "normal" cases.  What I'm thinking of (don't read this
if you have a bad heart!) is the case where a procedure to insert a row in
table_1 triggers multiple row insertions in table_2.

Something like :

Get ID
Start Transaction
  Insert row in table_1
  Insert trigger : until all cascade inserts are complete
  begin
Get ID
Insert row in subsidiary table  !! failure here is the problem
  end
Commit transaction

Since the number of cascaded inserts is unknown you can't book a block of
IDs - or can you? - and it seems to me that the Get ID call within the
transaction is unavoidable.

This is heading fot the too hard basket - at first look it appeared to solve
5 problems I'm facing where I have generic tables interfacing to multiple
master tables.  Perhaps I should just go back to a fully normalised database
g.

One of the design issues I am looking at is a post-it note table that allows
the user to add a notation to any data item within the application.  If IDs
are unique within the database every SQL statement can have an outer join to
the post-it table without having to identify the master table.  If I add the
master table ID it solves the problem, but adds to the SQL maintenance.  I
was looking for a quick way out :(

I will continue to mull this over.

Thanks for all the input

Stephen

-Original Message-
From: Neven MacEwan [mailto:[EMAIL PROTECTED]]
Sent: Friday, 12 January 2001 9:54 a.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: [DUG-DB]: Unique IDs


Stephen 

think about it last night why do you

1/ Code the 'generator' using a global table with an identity column
 ie

create proc GetID as
begin
  declare @NewID int
  insert into GenTable (InUse) values ('Y')
  set @NewID = @@identitiy
  return @NewID
end

then call this outside your transaction

-- get id's
exec @NewID1  =  GetID
begin tran
commit

occasionally you could clear the GenTable or use is as a log
or you could supplement your GetID proc with a reuse code to reuse any
ID's not used (not that i'd suggest this)

create proc FreeID @ID integer as
begin
  update GenTable set InUse = 'N' where  GenTableID = @ID
end

and alter GetID to check for possible Free ID's

HTH
Neven
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: ADO

2001-01-10 Thread Stephen Bertram

I'm new to ADO and have a quick question.

When I open an ADOQuery and navigate through the result set till eof is true
I cannot close the ADOQuery - it returns the error:
"Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record"

If not ADOQuery.eof the close method executes correctly.

This is with D5 update pack 1, Windows 2000 and MSSQL 7.

Unfortunately ATM I cannot access any internet resources, so I cannot browse
FAQ's on this.

TIA

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: Multi language development

2001-01-10 Thread Stephen Bertram

I'm about to start a project with multilanguage support.

I presume that there is somenone on the list who will be doing this already.
I am interested in their thoughts.

Is the Delphi language handling comprehensive?
Is it preferable to roll your own conversion methods?
What rules must be followed to make ALL displayed text automatically
converted?
What are the maintenance issues, both in the development and client
environments?

Any pointers will be welcome.

TIA 

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: [DUG-DB]: Unique IDs

2001-01-10 Thread Stephen Bertram

I need a bulletproof routine to create unique integer IDs for inserting rows
into multiple tables in a MSSQL 7 database.

The catches are that I want the ID's to be unique in the database, not just
each table, and the generator must be available to stored procedures.

Also the generator needs to unaffected by transactions - rollbacks should
not reset the sequence of values - and the generator must not be locked by a
slow transaction.

Any bright ideas?

Stephen

 
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: [DUG-DB]: Unique IDs

2001-01-10 Thread Stephen Bertram

The discussion so far has brought up 2 issues for me -
  Why not use GUIDs
Size
Difficulty in manual SQL manipulation
Lack of a directly mapable datatype in Delphi
Unavailability in some databases - we interface to Ingres
  Why use integers?
  Habit
Sequencing the order of row creation
Size

The suggestion that Gary has put forward is exactly what I was thinking of,
but I still don't see how to "remember" rolled back ID's.

The main problem is that if I use a single row table as the basis for the
generator, a rollback will reset the row back to the state before the start
of the operation, regardless of the fact that the row has been used to
generate new ID's by other processes in the meantime.  This would mean that
any IDs generated after this point may duplicate an ID generated during the
rolled back transaction. Locking the row until the transaction completes
would introduce an unacceptable delay.  I have not heard of anyway of
exempting a table update from the current transaction, but that is really
what I need to do.

Of course GUIDs are the answer if I can find a simple way of handling these
in Ingres and am prepared to type in huge banks of guff in SQL when tracing
rows.  I'll think about it.

Stephen


-Original Message-
From: Gary T. Benner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 11 January 2001 3:48 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: [DUG-DB]: Unique IDs


[Reply]

Your requirement needs to have a process that is not available in most
databases. You need some logic to not only give you a 
sequential number, but to also remember "roll backed" ID's and issue those
before generating new ID's.

This usually requires the creation of a pool of available ID's, and a
process to issue them to calling processes, and to have the issue 
confirmed (after a commit), or returned to the pool (after a roll back).

You can do this primarily  in the database (stored proc), as part of a
middle tier, or in your client as appropriate.

A stored procedure returning an ID value sounds the best option. It could
contain the code to housekeep the overall process.

Good Luck.


BTW, I am curious as to why the ID's have to be sequential. As a general
rule, primary keys in databases (sometimes called surrogate 
keys) should have no meaningful value, only be unique. If you wish to have
some meaning associated with data, then it should be a 
separate field, eg invoice number in a financial application, where it is
obvious that the number must be unique, and generally sequential 
- although in some cases not essential.

If you are using your unique ID for some process (such as replication or
briefcasing), then would it not be better to have the relevant 
process deal with gaps in the sequential number rather than insist upon it
in the first place?

BTW, rules are meant to be broken, and if there is a good reason for the
uniqueness, and sequentiality, then certainly go down the 
track you are.

Kind Regards

Gary



At 15:29 on 11/01/2001 Stephen wrote 

To  : 
CC  : 
From: Stephen Bertram, [EMAIL PROTECTED]
I need a bulletproof routine to create unique integer IDs for inserting
rows
into multiple tables in a MSSQL 7 database.

The catches are that I want the ID's to be unique in the database, not just
each table, and the generator must be available to stored procedures.

Also the generator needs to unaffected by transactions - rollbacks should
not reset the sequence of values - and the generator must not be locked by
a
slow transaction.

Any bright ideas?

Stephen

 
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: [DUG-DB]: Unique IDs

2001-01-10 Thread Stephen Bertram

The problem is :

Process 1 generates 11
Process 2 generates 12
Process 3 generates 13
Process 1 issues a rollback - ID 11 is now unused
Process 4 generates 11 - based on rolledback seed value.
Process 5 generates 12 !! Duplicate
Process 6 generates 13 !! Duplicate

Or am I missing something here?  I can't see how to hold a value that is the
basis for the next value (sequential or random) that isn't reset by a
rollback.

The other option of holding a table of all used values works well and is
safe, but we end up with a table of X million rows with an associated index
that does nothing useful.  If this was the selected option I suspect the
best functionality would be to create a random number and then check for
existance.  This at least would avoid the index problems that exist with
sequential keys in some environments.

Stephen


-Original Message-
From: Nic Wise [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 11 January 2001 4:52 p.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: [DUG-DB]: Unique IDs


 The suggestion that Gary has put forward is exactly what I was thinking
of,
 but I still don't see how to "remember" rolled back ID's.


do you really need to? does 1 2 3 6 7 8 9 10 14 16 17 make a difference, as
long as they are all in order whats it for?

N

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: Where should we put packages

2001-01-08 Thread Stephen Bertram

We're having a discussion on the easiest location for package and component
files in a multiuser environment.

The current practice is to hold all source in SourceSafe and check it out to
the developers local HD.  This is fine for units in projects, but does not
encourage the developers to update their components.

If we place the components in a common folder on the server we limit the
ability to develop and test new versions locally.

Can anyone give me a rundown on the best current practice for
multi-developer environments?

Also I am interested to hear your views of versioning software with Delphi -
SourceSafe is definitely not perfect.

Cheers

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: Event handling in a modal form

2000-12-13 Thread Stephen Bertram

I am trying to modify a legacy app which has a modal login form.  We now
want to skip the login if certain conditions are met.

Simple I thought - the FormActivate event can determine whether the
conditions are met and simulate the user's OK button click to "close" the
form. (All the application setup code is in the OK button OnClick event
handler).

This works well except that when the application is open it behaves as if
the login form is still active and does not allow user focus.

Any ideas on how or when I can fire the button click to avoid this?


Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Event handling in a modal form

2000-12-13 Thread Stephen Bertram

Paul : 
Can you do the Evaluation in the DPR and Create or not Create the Logon 
Form ?

Of course I can - but I'm trying to avoid too much rewriting and there's a
hell of a lot of business logic in the Form Activate and On Click event
handlers. 

Nello :
how are you simulating the "ok" click?

By issuing a btnOK.click at the end of the FormActivate code.

be sure you are setting ModalResult:=mrOK  or ModalResult:=mrCancel
depending on the outcome you want to force.

The button has ModalResult set to mrOK, but the onClick handler will change
this if certain conditions aren't met.

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: AddObject and record structures

2000-12-13 Thread Stephen Bertram

I do this by creating the record structure with new first - eg

procedure add(strlst : TStringList; txt : string; [items for record] ...)
var
   rec_ptr : ^TNodeRecord;
begin
   new(rec_ptr);
   rec_ptr^.ntype  := typ;
   rec_ptr^.level  := level;
   rec_ptr^.actionable := actionable;
   rec_ptr^.populated  := populated;
   rec_ptr^.expandable := expandable;
   rec_ptr^.filtered   := false;
   rec_ptr^.filter := '';
   rec_ptr^.text   := text;
   rec_ptr^.ref:= ref;
   strlst.addobject(txt, recptr);
end;

HTH

Stephen
  

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, 15 December 2000 05:17
To: Multiple recipients of list delphi
Subject: [DUG]: AddObject and record structures


Hi all.

I have been doing some stuff with ADDObject in stringlists and passing ecord
structures thru.

I found that I cold go...mystrings.addobject('hello',myrecord) perfectrly
fine IF the record structrue only had one entry...
i.e. TMyRecord = record
  iPs :Integer;

BUT If I add an oher entry (1 or more of them)
i.e. TMyRecord = record
  iPs :Integer;
  ime :integer;
etc.

It will no longer compile with an incompatable type error on the addobject
line.

Whay IS thisI am not sure whay this happens...can anyone offer an
explination...and a solution?

Cheer, Jeremy Coulter  


 
 
 

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: AddObject and record structures

2000-12-13 Thread Stephen Bertram

You just have to reverse the process eg

function read_record(strlst : TStringList; idx : integer): 
var
  rec_ptr : ^TNodeRecord;
  level := integer;
  typ   := TRecType;
begin
   rec_ptr := strlst.objects[i];
   typ:= rec_ptr^.ntype;
   level  := rec_ptr^.level; 
   ...

Not intuitive for me, but then I'm not a C programmer g

Stephen



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, 15 December 2000 05:47
To: Multiple recipients of list delphi
Subject: RE: [DUG]: AddObject and record structures


I tried this, but had problems at the other end when I went to extract the
items i.e. alwasy GPF'd on me.

Jeremy Coulter
 
 
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: AddObject and record structures

2000-12-13 Thread Stephen Bertram

I agree entirely Patrick, but when your existing application has screeds of
treeviews the objects are very convenient for a QD extension using the
existing node navigation.

Stephen

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: AddObject and record structures

2000-12-13 Thread Stephen Bertram

On reflection I would do as Patrick suggests - declare the structure as a
class

TNodeRecord = record   ==  TNodeObject = class(TObject)
   typ : TRecType; typ : TRecType;
   ... ...

my_pointer := new(TNodeRecord);  ==   my_object := TNodeObject.create;
my_pointer^.typ := curr_type;  my_object.typ := curr_type;
......
strlst.addobject(txt, my_pointer); strlst.addobject(txt, my_object);

my_pointer := strlst.objects[idx]; my_object := strlst.objects[idx];
old_type := my_pointer^.typ;   old_type := my_object.typ;
---

and then you can forget the pointers entirely.  I have been using the
pointer method due to matching older code, not from conviction.

Remember to dispose record structures created with new() in the same way you
free objects created with create().

HTH 

Stephen

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: ISAPI DB App query

2000-12-12 Thread Stephen Bertram

There are several ways to handle this.  It depends on the number of
accesses, required response, DB server load.

1. Have each user session allocated a unique session ID and record the range
they have last accessed in a SID table.  Note that anything like this
precludes the use of straight HTML as the SID value needs to be included in
every form and URL.

2. Include the next and previous row IDs of the dataset in the Next and
Prior button URLs.

3. Load the dataset into a textfile and use an index into this as the
navigating pointer - not live, but doesn't load the DB and is very fast.
Only useful if the underliying data is not changing much.  I've used this
with search results so that a complex query is run only once and the
resulting data is available for browsing or subselects.

4. Use a TCP/IP socket or COM application to cache the dataset or keep the
query alive for navigation.

I must admit that I have never figured how to identify a user session from
the server parameters available to a CGI/ISAPI.  If the app could see the
session id from the server life would be a lot simpler.

HTH

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Can delphi do this ?

2000-12-10 Thread Stephen Bertram

In the past I have initialised a stringlist with the function names and the
function pointer held in the data object.  This does require that all
functions called in this way have a standard parameter and return format,
but it's easily maintained, and error trapping and debugging are simple.

Regards

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Anyone using ERWin ?

2000-12-06 Thread Stephen Bertram

Yes - we use it for our schema control.

What would you like to know?

Stephen Bertram

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, 8 December 2000 03:59
To: Multiple recipients of list delphi
Subject: [DUG]: Anyone using ERWin ?


Hi al.

Is anyone out there using a product called ERWin ?
 (not strictly a Delphi question...but trying to reach everyone I
can...sorry)


Jeremy Coulter
 
 
 

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Anyone using ERWin ?

2000-12-06 Thread Stephen Bertram

Sorry - you're way ahead of my knowledge.  We use it to keep the table
relationships and constraints for the schema in Sybase, MSSQL and Oracle.
We handle all SPs and triggers via independent scripts.

IMHO ERWin is a overcomplicated beast that becomes difficult to use as soon
as you get a DB that has a realistic number of tables, but it does have good
modelling capabilities.

Stephen Bertram

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, 8 December 2000 04:36
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Anyone using ERWin ?


Well, at last job we used with Interbase, and I remember when we wanted to
add a new stored procedure that say updated or alteed a DB, we could at it
to the schema properties editor by selecteding an unattached template, then
add the stored proc code to the Sp Template window, tehn it would go into
the SP Exspantion window, and from memory, it created a nwe template from
that that I could attach.
is this right ??
At the moment, I seem to have to make a new template, then select it, then
add teh stored proc to the window then attach it...if you knw what I mean.

ts just that its been a while since I used it (4-5 mths) and we have a demo
verson for trialing, and no manuals etc.

Any help greatly appreciated

Jeremy Coulter
 
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: BDE Error

2000-12-04 Thread Stephen Bertram

I have a single threaded MDI application which has started giving me an
EDBEngineError "Connection is in use by another statement" on a TQuery.open
when a particular MDI child form is opened.  Developed in Delphi 4 with
Sybase 11

Any ideas how to pin down the conflict or the source of the error?

TIA

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: BDE Error

2000-12-04 Thread Stephen Bertram

Thanks, that seems to have cleared it. 

Strange that its worked for some years without a problem :-)

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Creating An Object At Run Time

2000-11-29 Thread Stephen Bertram

You can store the pointer of the treeview in a TList object and use the
index in the TList to access it.  The trick is to keep a handle on what each
pointer represents. This just duplicates the internals of a TForm. 

I've seen an implementation where each intance is given a unique .tag
property and the application searches through the Controls array to find the
TControl(Form.Controls[i]).tag that matches.

The simplest way (if you know the maximum number of treeviews) is to declare
all possible treeviews as variables in the unit and instantiate them as
required.  There is very little memory penalty with this as no resources are
allocated until the object is instantiated.  This does require you to test
them and free any instances in the Form.onDestroy event.

HTH

Stephen

-Original Message-
From: Chrissy R [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 30 November 2000 13:04
To: Multiple recipients of list delphi
Subject: [DUG]: Creating An Object At Run Time


Hi,

Thanks for you help yesterday on creating an object (TreeView) but I am
still having problems.  I can create as many objects as I want but I do not
know how to access these in code at a later stage.  I want to be able to 
insert, delete etc nodes, make the TreeView invisible and lots of other
things
but I do not know what it is called so I cannot use, for example, 

xxx.Visible := False;

I do not know what to use in place of "xxx".  The code is as follows and
there
is one form with a button and two units - all with default names.


Chrissy.


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls, StdCtrls, unit2;

type
  TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  MyList1: TMyList;
begin
  MyList1 := TMyList.Create(Self);
  MyList1.Parent := Form1;
  MyList1.Items.AddChildFirst(nil,MyList1.Name);
  MyList1.Name := 'TreeView';
  MyList1.Visible := True;
  MyList1.Items.AddChildFirst(nil,MyList1.Name);
  MyList1.SendToBack;
end;

end.


unit Unit2;

interface

uses
  ComCtrls, Controls, Classes;

type
  TMyList = class(TCustomTreeView)
  public
constructor Create(AOwner: TComponent);
  published
property Items;
  end;

implementation

constructor TMyList.Create(AOwner: TComponent);
begin
  inherited Create(Owner);  // Initialize inherited parts
  Align := alLeft;
end;

end.


---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Procedure Problem

2000-11-28 Thread Stephen Bertram

Normally the event handler does not use the 'Sender' parameter so you can
use 'nil' or 'self'.  

If the handler does use the 'Sender' you should use the component your
procedure is trying to emulate.
e.g. If you logic says you want to emulate pressing ButtonA then call the
handler as   ButtonAClick(ButtonA);

HTH

Stephen Bertram

-Original Message-
From: Joel van Velden [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 29 November 2000 15:47
To: Multiple recipients of list delphi
Subject: [DUG]: Procedure Problem


Hi there all,

Just 1 newbie question:

How do I run an event-handlers procedure from somewhere else in the program?
ie, What do I give as 'Sender' in 'procedure TForm3.ListBox1Click(Sender:
TObject);'

TIA,
Joel van Velden

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Creating A Class

2000-11-28 Thread Stephen Bertram

Question - is the new component automatically freed when the form is
destroyed?  

I've normally kept a list of components created on the fly and specifically
freed them - maybe I don't need to.

Stephen

-Original Message-
From: Stacey Verner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 29 November 2000 16:02
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Creating A Class


You need to set the parent to a form, tabsheet, panel etc..

e.g.

procedure TForm1.Button1Click(Sender: TObject);
var
  MyList1, Q: PMyList;
begin
  New(Q);
  MyList1 := Q;
  MyList.Parent := Self;
  MyList1.Visible := True;
end;

On another note. The way you are createing you objects looks a little odd to
me. I checked the help to see what you were doing and its all fine, but the
way we would normally do it is as follows:

procedure TForm1.Button1Click(Sender: TObject);
var
  MyList1: TMyList;
begin
  MyList1 := TMyList1.Create(nil {or whatever paremeters are requitred});
  MyList.Parent := Self;
  MyList1.Visible := True;
end;

Stacey

 -Original Message-
 From: Chrissy R [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 29 November 2000 3:51 p.m.
 To: Multiple recipients of list delphi
 Subject: [DUG]: Creating A Class
 
 
 Hi,
 
 I am trying to create, at run time, a number of instances of 
 a TTreeView.  I have
 created a class of this type and I will add some methods to 
 this.  I can create this
 in one unit and, when I press a button on my form, things 
 seem to work but I 
 cannot get this new object to display.  The code that I have 
 for the button click is
 
 procedure TForm1.Button1Click(Sender: TObject);
 var
   MyList1, Q: PMyList;
 begin
   New(Q);
   MyList1 := Q;
   MyList1.Visible := True;
 end;
 
 The MyList1.Visible line fails with an access violation and I 
 do not know what
 I am doing.  Please help me.
 
 Chrissy.
 
 --
 -
 New Zealand Delphi Users group - Delphi List - 
 [EMAIL PROTECTED]
   Website: http://www.delphi.org.nz
 To UnSub, send email to: [EMAIL PROTECTED] 
 with body of "unsubscribe delphi"
 
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: TDBLookupComboBox blues

2000-11-22 Thread Stephen Bertram

I have a application including 2 TDBLookupComboBoxes connected to 3
TClientDataSets.  They work as long as the underlying dataset is unfiltered
or the filter does not change.

Unfortunately the filter on one of the lookup datasets is driven by a field
derived from the main dataset, so is refiltered as the main dataset scrolls
and I cannot get it to resync to the keyfield in the main dataset, even
though the related row is within the filtered set.

Does anyone have a quick fix for this or pointers to a component that will
handle this?

My next step will be to code the component as a TCombobox and manual
populate it and handle events :-( 

TIA

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



[DUG]: TDBLookupComboBox blues

2000-11-22 Thread Stephen Bertram

I have a application including 2 TDBLookupComboBoxes connected to 3
TClientDataSets.  They work as long as the underlying dataset is unfiltered
or the filter does not change.

Unfortunately the filter on one of the lookup datasets is driven by a field
derived from the main dataset, so is refiltered as the main dataset scrolls
and I cannot get it to resync to the keyfield in the main dataset, even
though the related row is within the filtered set.

Does anyone have a quick fix for this or pointers to a component that will
handle this?

My next step will be to code the component as a TCombobox and manual
populate it and handle events :-( 

TIA

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: TDBLookupComboBox blues - solved

2000-11-22 Thread Stephen Bertram

I found that I could get it to work by leaving the dataset unfiltered except
when the list is dropped down.  Clunky, but it works.

Stephen
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Appearance of disabled controls

2000-11-21 Thread Stephen Bertram

From my experience you have to live with the fact that Windows will impose
it's grayed text standard to all disabled controls.  We have done the "Read
Only, TabStop false" thing and quietly cursed.  

As others have already pointed out it does have the advantage of allowing
the user to copy the text from the "disabled" control.

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



RE: [DUG]: Web Stuff

2000-11-13 Thread Stephen Bertram

 Delphi has proven extremely efficient in web development, especially when
 accessing databases.

I'd add a caveat here - I've had great difficulty getting web applications
to scale when using BDE.  Using alternative database access has made life a
lot easier.

Stephen Bertram
---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"