Re: [DUG] Strange behavour - WebBrowser and ADO

2011-08-04 Thread Dennis Chuah

Folks,

Hi.  You guys may want to know the solution to this issue.  If you call 
TWebBrowser.ExecWB, after it returns, you will find that the EmptyParam 
global variable is no longer the same value.  It gets set to Unassigned. 
There is a bug logged on Quality Central:

http://qc.embarcadero.com/wc/qcmain.aspx?d=61255

This is perhaps not a VCL bug per se, but more of how Delphi calls dual 
interface methods and perhaps a bug in IE itself.  The workaround is simple, 
bypass TWebBrowser.ExecWB and call the browser's ExecWB method directly, 
passing in dummy OLEVariant variables initialised to the same value as 
EmptyParam.

Regards,
Dennis.

--
From: Edward Huang edwa...@slingshot.co.nz
Sent: Wednesday, August 03, 2011 7:39 PM
To: 'NZ Borland Developers Group - Delphi List' delphi@delphi.org.nz
Subject: [DUG] Strange behavour - WebBrowser and ADO

 Hi,

 We have just noticed a strange behaviour recently, which I couldn't figure
 out how to resolve.  The issue could have been there all the time, just we
 didn't used the sequence before.

 We have an application, uses ADO to connect to SQL Server database.
 Components used include TADOQuery, TADOStoreProcedure etc.  It all works
 fine.

 Then we have a form which contains among other things, a TWebBrowser and a
 'Print' button.  On click event of the Print button, we call:

  WebBrowser_Help.ExecWB(OLECMDID_PRINT, 1);

 Which will bring up printing dialog and print the contents of the
 TWebBrowser component.

 The strange thing is that after the Print button clicked, subsequent 
 access
 to database via ADO components all failed with Exception.  The following 
 is
 a sample exception message:

 Arguments are of the wrong type, are out of acceptable range, or are in
 conflict with one another

 I have tried to close ADOConnection, reopen etc, the database access still
 doesn't success.

 Anyone knows how to fix this issue?

 Edward




 ___
 NZ Borland Developers Group - Delphi mailing list
 Post: delphi@delphi.org.nz
 Admin: http://delphi.org.nz/mailman/listinfo/delphi
 Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
 unsubscribe 

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe


Re: [DUG] Sending notification between programs

2010-08-18 Thread Dennis Chuah

John,

Hi.  What I'd suggest is you use FILE_NOTIFY_CHANGE_FILE_NAME.  Program A 
creates the file and writes to it using a temporary filename.  When it is 
done writing, it renames the file to something that program B recognises. 
This will trigger a FILE_NOTIFY_CHANGE_FILE_NAME and B can then pick up the 
file.  Actually, creating the file will also trigger a 
FILE_NOTIFY_CHANGE_FILE_NAME, but A is using a temporary filename that B 
does recognise, B ignores it.

Regards,
Dennis.

--
From: John Bird johnkb...@paradise.net.nz
Sent: Wednesday, August 18, 2010 6:02 PM
To: NZ Borland Developers Group - Delphi List delphi@delphi.org.nz
Subject: Re: [DUG] Sending notification between programs

 The property
 FILE_NOTIFY_CHANGE_LAST_WRITE

 looks like a possibility, as if structured data has just been written to a
 file this event should be triggered.   The only gotcha seems to be that 
 the
 better the caching is the less likely the event will fire - according to 
 the
 help.  Tricky.

 John


 John,

 Hi.  What you want to use is WinAPI: FindFirstChangeNotification,
 FindNextChangeNotification and FindCloseChangeNotification in program B.
 Essentially, A writes to a file, and renames it.  This causes the handle
 returned by FindFirstChangeNotification to be signaled.  You can test for
 this using a loop and WaitForSingleObject / WaitForMulitipleObjects.  You
 can even specify a timeout in the WaitXXX calls so that B wakes
 periodically, even if there are nothing signaled.  When the WaitXXX
 function
 returns, you can check for the existence of the file.

 Regards,
 Dennis.

 --
 From: John Bird johnkb...@paradise.net.nz
 Sent: Wednesday, August 18, 2010 4:43 PM
 To: NZ Borland Developers Group - Delphi List delphi@delphi.org.nz
 Subject: [DUG]  Sending notification between programs

 Which way would you favour to do the following ?

 I have two Delphi programs (A and B) that I will pass data from A to B -
 I
 will probably use  a file to put the data in because its quite
 structured.
 B will sleep on a timer loop until this something is triggered.

 What I want to do is send a simple notification from program A to B that
 there is something to do - i.e. trigger an event in B to wake and do
 something to process this.

 There are various ways I could communicate this notification

 1 - Has to add minimal overhead of size and processing to programs A and
 B
 2 - A can tolerate B not responding immediately without freezing but
 preferably will know

 The ways I have considered to be candidates are

 a - Windows messaging
 b - TCP/IP Indy   (which could send the data too.  (adds complexity of
 needs to be done in a thread to not affect the main program A)
 c - make program B a DLL
 d - Roll my own - make a timer in B which polls for for some condition
 and
 otherwise continues to sleep
 e - something else.

 Kindly share your favoured options how you might do this.

 John



 ___
 NZ Borland Developers Group - Delphi mailing list
 Post: delphi@delphi.org.nz
 Admin: http://delphi.org.nz/mailman/listinfo/delphi
 Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject:
 unsubscribe

 ___
 NZ Borland Developers Group - Delphi mailing list
 Post: delphi@delphi.org.nz
 Admin: http://delphi.org.nz/mailman/listinfo/delphi
 Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject:
 unsubscribe


 ___
 NZ Borland Developers Group - Delphi mailing list
 Post: delphi@delphi.org.nz
 Admin: http://delphi.org.nz/mailman/listinfo/delphi
 Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
 unsubscribe
 
___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe


Re: [DUG] Sending notification between programs

2010-08-17 Thread Dennis Chuah

John,

Hi.  What you want to use is WinAPI: FindFirstChangeNotification, 
FindNextChangeNotification and FindCloseChangeNotification in program B. 
Essentially, A writes to a file, and renames it.  This causes the handle 
returned by FindFirstChangeNotification to be signaled.  You can test for 
this using a loop and WaitForSingleObject / WaitForMulitipleObjects.  You 
can even specify a timeout in the WaitXXX calls so that B wakes 
periodically, even if there are nothing signaled.  When the WaitXXX function 
returns, you can check for the existence of the file.

Regards,
Dennis.

--
From: John Bird johnkb...@paradise.net.nz
Sent: Wednesday, August 18, 2010 4:43 PM
To: NZ Borland Developers Group - Delphi List delphi@delphi.org.nz
Subject: [DUG]  Sending notification between programs

 Which way would you favour to do the following ?

 I have two Delphi programs (A and B) that I will pass data from A to B - I 
 will probably use  a file to put the data in because its quite structured. 
 B will sleep on a timer loop until this something is triggered.

 What I want to do is send a simple notification from program A to B that 
 there is something to do - i.e. trigger an event in B to wake and do 
 something to process this.

 There are various ways I could communicate this notification

 1 - Has to add minimal overhead of size and processing to programs A and B
 2 - A can tolerate B not responding immediately without freezing but 
 preferably will know

 The ways I have considered to be candidates are

 a - Windows messaging
 b - TCP/IP Indy   (which could send the data too.  (adds complexity of 
 needs to be done in a thread to not affect the main program A)
 c - make program B a DLL
 d - Roll my own - make a timer in B which polls for for some condition and 
 otherwise continues to sleep
 e - something else.

 Kindly share your favoured options how you might do this.

 John



 ___
 NZ Borland Developers Group - Delphi mailing list
 Post: delphi@delphi.org.nz
 Admin: http://delphi.org.nz/mailman/listinfo/delphi
 Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
 unsubscribe 

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe


Re: [DUG] faster TreeView

2010-07-23 Thread Dennis Chuah

Hi.  Check out Virtual Treeview http://www.soft-gems.net/.  Very fast and 
very flexible.  The programming paradigm is different, so there is a leaning 
curve.  But once you get over that, you will find that it is the best 
treeview / grid component ever.

Regards,
Dennis.

--
From: Rogério Martins rogmart...@gmail.com
Sent: Saturday, July 24, 2010 12:42 AM
To: NZ Borland Developers Group - Delphi List delphi@delphi.org.nz
Subject: [DUG] faster TreeView

 Hi all !
 Does any one know a TreeView component faster than the original borland
 TTreeView when adding, deleting nodes (many at once) and changing its text 
 ?

 Thanks




 ___
 NZ Borland Developers Group - Delphi mailing list
 Post: delphi@delphi.org.nz
 Admin: http://delphi.org.nz/mailman/listinfo/delphi
 Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
 unsubscribe 

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe


Re: [DUG] Script Engines for use with Delphi

2010-03-22 Thread Dennis Chuah

Python for Delphi works very well.  Python is open sourced and there is 
great support.

Javascript (and vbscript) via Windows Script work fine too.  Not as 
functional as Python but there is a bigger user base.

--
From: Alistair Ward aw...@forum8.co.nz
Sent: Monday, March 22, 2010 3:03 PM
To: delphi@delphi.org.nz
Subject: [DUG] Script Engines for use with Delphi

 Hi,

 We're looking to integrate a scripting engine of some sort into a Delphi 
 app.

 Possibilities are:
 1) DelphiScript from RemObjects
 2) Python for Delphi
 3) TMS Scripter Studio
 4) JavaScript (?)

 Has anybody had experience with using any of these products? I am 
 particularly interested if anyone has managed to integrate JavaScript with 
 a Delphi app.

 Thanks,
 Alistair Ward
 Forum 8 NZ Ltd.




 ___
 NZ Borland Developers Group - Delphi mailing list
 Post: delphi@delphi.org.nz
 Admin: http://delphi.org.nz/mailman/listinfo/delphi
 Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
 unsubscribe 

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe


Re: [DUG] MSSQL with D2007

2010-01-18 Thread Dennis Chuah

John,

Hi.  If you do not use data aware controls, or otherwise need TDataset, then 
I would recommend that you use ADO directly.  Fast, simple, and does not 
have the overhead of TADOConnection, etc.  I normally import the type 
library into Delphi, but you can also use the one that comes with Delphi.

Regards,
Dennis.

--
From: John Bird johnkb...@paradise.net.nz
Sent: Tuesday, January 19, 2010 8:04 PM
To: NZ Borland Developers Group - Delphi List delphi@delphi.org.nz
Subject: [DUG]  MSSQL with D2007

 Been trying to connect to MSSQL 2005 with DB Express (TSQLConnection and 
 TSQLQuery), but cannot get it to work, we are getting an access violation 
 at address 017E0913  in DBXMSS30.DLL  read of address 0182

 Using instead ADO (TADOConnection and TADOQuery) works fine, but is slow - 
 7000 records takes 30-40 seconds to load.

 The rest of the components the same  (ie TDatasetProvider, TCLientDataSet, 
 TDatasource)  ie have been pointing the Datasetprovider at either the 
 TADOQuery or the TSQLQuery

 Also tried the TSimpleDataSet, has the same error as the first sentence.
 All the queries allow me at design time to set active to true 
 successfully, but still crash when the dataset is set to open

 Does anyone have any idea what could be going wrong?

 And any recommendations of best combinations you prefer for MSSQL with 
 D2007.   I am new to connecting D2007 to MSSQL so willing to do it 
 whichever way works best.

 John



 ___
 NZ Borland Developers Group - Delphi mailing list
 Post: delphi@delphi.org.nz
 Admin: http://delphi.org.nz/mailman/listinfo/delphi
 Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
 unsubscribe 

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe


Re: [DUG] Just for the odd job.

2009-07-15 Thread Dennis Chuah

I don't belief it ... there are actually people still using Delphi 4.  It 
has to be the next most buggy version of Delphi apart from 8.  You can even 
get different EXEs just by compiling at different times of the day!

My advise then would be for you to upgrade, even if it is just to get a more 
stable version of Delphi!

Saying that, you will not be able to use your D4 components unless you have 
the source.  Even so, part of the VCL have changed and they may need some 
work to get going.

- Original Message - 
From: Marshland Engineering marshl...@marshland.co.nz
To: delphi@delphi.org.nz
Sent: Wednesday, July 15, 2009 10:30 PM
Subject: [DUG] Just for the odd job.


I have been using Delphi 4 for the few projects I have.

Embarcadero Technologies are a offering 2 for 1 purchase.

Why is Delphi 2009 - Professional Upgrade and Delphi 2007 for Win32 R2 
Professional Upgrade both the same price.

Is it worth the upgrade.

From what I understand  2007 and 2009 makes bigger exes and are they is 
compatible with Ver 4 software.
I have quite a few third party ver 4 components installed on my system.

Thanks Wallace












 ___
 NZ Borland Developers Group - Delphi mailing list
 Post: delphi@delphi.org.nz
 Admin: http://delphi.org.nz/mailman/listinfo/delphi
 Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
 unsubscribe 

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe


Re: [DUG] PDFCreator

2007-11-08 Thread Dennis Chuah


A better PDF creator is Primo - just google for Primo PDF.  Its freeware and 
produces better quality output.


- Original Message - 
From: John [EMAIL PROTECTED]

To: 'NZ Borland Developers Group - Delphi List' delphi@delphi.org.nz
Sent: Thursday, November 08, 2007 8:09 PM
Subject: [DUG] PDFCreator


Hi Eion

This PDFCreator is really fantastic! Thanks for the tip Eion. The only thing
I don't understand is that, after choosing the PDFCreator as output device
and printing the document, it starts installing SmartSound QuickTracks
Plug-in. Although I cancel this all works fine. Is this normal? Is there any
way to disable this feature?

Cheers
John

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Eion McIntosh (Christchurch)
Sent: Thursday, 8 November 2007 2:09 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: RE: [DUG] Quick Reports


Hi

We generally are now using PDFCreator which is freeware and can be found at
http://www.pdfforge.org/products/pdfcreator/. If just installs as a printer
and when you want to create a PDF, just change your printer to the
PDFCreator printer and print as normal. I've used it numerous times for
various projects and it works great. Plenty of different options for setting
it up for saving, auto-saving, filename, PDF Format and DPI settings.

Regards
Eion McIntosh
PPCS Ltd








___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: 
unsubscribe 


___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Expression Parser/Evaluator

2007-10-24 Thread Dennis Chuah


Try Python for Delphi.  It can do all that you want below, plus a lot more. 
And besides, the price is right!


- Original Message - 
From: David Brennan [EMAIL PROTECTED]

To: DUG delphi@delphi.org.nz
Sent: Wednesday, October 24, 2007 4:18 PM
Subject: [DUG] Expression Parser/Evaluator



Hi,



Another question in the popular family of what is the best component 
suite

for X?.



Can anyone recommend a good expression parser/evaluator? Ideally a bit 
more

than just mathematical expressions, we would like it to handle logical
evaluation (ie Booleans), IF statements and ideally strings (primarily for
comparison within boolean IF conditions but if the parser/evaluator could
handle strings as results then all the better). We don't need any loop
constructs or more advanced program control constructs. We would probably
like to be able to define our own expression functions but the user 
probably

doesn't need to be able to.



Quality (ie reliability), functionality and availability of source code 
are

our main criteria here. Price isn't going to be so much of an issue unless
they are hideously expensive or there are multiple good options to choose
between.



Any recommendations? Warnings on what to avoid?



Thanks,

David.



























___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: 
unsubscribe 


___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Debugger - variable values

2007-08-07 Thread Dennis Chuah


To see the contents of a string list, a quick way (turn on allow function 
calls):


srcTemplateInputLines.Text or
srcTemplateInputLines.CommaText

to see an individual element:

srcTemplateInputLines[0], or srcTemplateInputLines[1], ...

- Original Message - 
From: John Bird [EMAIL PROTECTED]

To: 'NZ Borland Developers Group - Delphi List' delphi@delphi.org.nz
Sent: Tuesday, August 07, 2007 7:16 PM
Subject: [DUG] Debugger - variable values



There is something I wanted to know about the debugger.I love the
debugger being able to examine the values of variables in code.  I have 
also

got used to that it just won't show the values of some.   Loop pointers
often won't get shown, particularly as you say after the loop is finished.
Some others as well, I assume because of optimisation, or sometimes simply
because it is time to reboot the PC or restart the IDE.

The other type I had got used to never seeing the value of was a member of 
a

stringlist, eg

   TmWorkLine1:=srcTemplateInputLines.Strings[TemplatePtr];

The debugger would just show srcTemplateInputLines | () as the value.
However one day, and it has only happened once, it did show the value of 
the

string.  I got a surprise!

So.is the debugger supposed to be able to show the actual string 
values

in a stringlist or not?

John


___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: 
unsubscribe




___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Pulling status bar text off another application

2007-07-30 Thread Dennis Chuah


Why don't you use automation to get access to the browser application 
object.  From there you can use the HTML Dom to get access to the status bar 
text.


- Original Message - 
From: Phil Scadden [EMAIL PROTECTED]

To: delphi@delphi.org.nz
Sent: Monday, July 30, 2007 2:57 PM
Subject: [DUG] Pulling status bar text off another application



A webapp running in IE put text in the status bar that I would dearly like
to snaffle into another running application. Statusbar I think is a 
wincontrol

so could be possible. Anyone with bright ideas on discovering it?

--
Phil Scadden, GNS Science Ltd
764 Cumberland St, Private Bag 1930, Dunedin, New Zealand
Ph +64 3 4799663, fax +64 3 477 5232

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: 
unsubscribe




___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] Pulling status bar text off another application

2007-07-30 Thread Dennis Chuah


A far easier way would be to use the HTML Dom.  Get it done in a couple of 
lines of code.


- Original Message - 
From: Jeremy Coulter [EMAIL PROTECTED]

Sent: Monday, July 30, 2007 10:44 PM


Yes you are correct, you will need either the class name OR the name of 
the

control.
So, to do that, you use something like Spy++ which comes with Visual 
Studio,

or download for free windose from Greatis software which will give yo that
information.

Trust me, this definitly works on NON Delphi apps too. The getting 
info

from controls on a non delphi app. that is.


Jeremy

-Original Message-
From: Matthew Comb [mailto:[EMAIL PROTECTED]
Sent: 30 July 2007 22:36
To: [EMAIL PROTECTED]; 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Pulling status bar text off another application

Correct me if I am wrong it's been a while, but you require the windows
class name in order to use FindWindowsEx ?

Your two calls use 'TfmMain' and 'TStatusbar' which are Delphi specific.

It's worthwhile keeping this in mind when thinking about 'ANY browser and
ANY app'

Your code won't work for any browser consistently.

Only way you can achieve that is by using a common interface.

Of course if you know the application you are wanting to connect to and 
can

determine these classnames then you don't have to worry.

Matt.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
On

Behalf Of Jeremy Coulter
Sent: Monday, 30 July 2007 7:32 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Pulling status bar text off another application

Nope, not at all. If you LOOK at the code you will seeit uses 
FindWindowEx

to find a child control. It could be a VB textbox for all it cares.
Infact, I have uses FindWindowEx to actually access a disabled textbox ina
vb app, and change it to being enabledso I could copy the text from it
and paste it into my delphi appcost I can nearly ALWAYS find a
hack...hehhehe

Jeremyp.s Matt, you firndigtal.com email bounced back when I replied.

-Original Message-
From: Matthew Comb [mailto:[EMAIL PROTECTED]
Sent: 30 July 2007 19:06
To: [EMAIL PROTECTED]; 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Pulling status bar text off another application

 It also means that Phil can support ANY browser, or ANY app. That has a
statusbar.

That was written in Delphi ? :)

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
On

Behalf Of Jeremy Coulter
Sent: Monday, 30 July 2007 7:03 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Pulling status bar text off another application

Did ANYONE apart from Phil take a look at the code I supplied??
My function does it is a LOT less complex manner that some of the ideas
suggested thus far.
It also means that Phil can support ANY browser, or ANY app. That has a
statusbar.

Jeremy

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
On

Behalf Of Dennis Chuah
Sent: 30 July 2007 18:49
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Pulling status bar text off another application


Why don't you use automation to get access to the browser application
object.  From there you can use the HTML Dom to get access to the status 
bar

text.

- Original Message -
From: Phil Scadden [EMAIL PROTECTED]
To: delphi@delphi.org.nz
Sent: Monday, July 30, 2007 2:57 PM
Subject: [DUG] Pulling status bar text off another application



A webapp running in IE put text in the status bar that I would dearly
like  to snaffle into another running application. Statusbar I think is
a  wincontrol  so could be possible. Anyone with bright ideas on
discovering it?

--
Phil Scadden, GNS Science Ltd
764 Cumberland St, Private Bag 1930, Dunedin, New Zealand Ph +64 3
4799663, fax +64 3 477 5232

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe



___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.10.19/917 - Release Date: 
25/07/2007

01:16


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.10.19/917 - Release Date: 
25/07/2007

01:16



___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe

Re: [DUG] basic question

2007-07-26 Thread Dennis Chuah


A constructor ALWAYS creates an instance, even if it encounters an 
exception.  The implicit exception handling code then finalises the 
instance.


- Original Message - 
From: Jeremy North [EMAIL PROTECTED]

To: NZ Borland Developers Group - Delphi List delphi@delphi.org.nz
Sent: Thursday, July 26, 2007 9:35 AM
Subject: Re: [DUG] basic question



On 7/26/07, Dennis Chuah [EMAIL PROTECTED] wrote:


...  A constructor always instantiates an instance.


Unless the constructor raises an exception.
___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: 
unsubscribe




___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] basic question

2007-07-26 Thread Dennis Chuah


No, a constuctor will not return Nil.  If an exception is raised in a 
constructor, the implicit finalisation code is called (which then calls the 
Destructor), and the exception bubbles up to the next exception handler.


- Original Message - 
From: Jeremy North [EMAIL PROTECTED]

To: NZ Borland Developers Group - Delphi List delphi@delphi.org.nz
Sent: Thursday, July 26, 2007 7:09 PM
Subject: Re: [DUG] basic question



Which means any constructor could return NIL. Which you didn't make
clear in your explanation. I just wanted to clear that up for others
incase they weren't aware of this.

On 7/26/07, Dennis Chuah [EMAIL PROTECTED] wrote:


A constructor ALWAYS creates an instance, even if it encounters an
exception.  The implicit exception handling code then finalises the
instance.

___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: 
unsubscribe




___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe


Re: [DUG] basic question

2007-07-25 Thread Dennis Chuah


It is called a constructor ... subtle differences, but *significant*.  Eg., 
you cannot return a Nil from a constructor.  A constructor always 
instantiates an instance.


As for the use of class methods ... plenty.  Eg., use it to replace unit 
procedures and functions.  Use it to implement singleton classes and class 
factories.  Class methods can also be virtual and get overriden, etc.  The 
'self' parameter to class methods is the class reference.  Not as useless as 
Neven thinks.


- Original Message - 
From: David Moorhouse [EMAIL PROTECTED]

To: NZ Borland Developers Group - Delphi List delphi@delphi.org.nz
Sent: Wednesday, July 25, 2007 10:15 PM
Subject: Re: [DUG] basic question



AnInstance := TAnObject.Create;

if that's not a class method I'm not sure what is ;)

D


On Wed, 25 Jul 2007 21:33:25 +1200, you wrote:


Sean

Thanks, I grovel corrected :-), Still little use with no data, ie Data +
Algorithms = Programs

N

Class methods have been around for years, explicitly.  As in
TMyClass.DoSomething, no nil instances required.
 have just looked it up in my Using Delphi 3 (pub 1997) book that I 
keep

lying around for no apparent reason, so it's been at least a decade.

Class variables etc are newer


Regards

Sean
---
Sean Cross
mailto:[EMAIL PROTECTED]

Pics Print - The photo printing solution for Windows.
http://www.picsprint.com

Rental Property Manager - Rental management made easy
http://www.sourceitsoftware.com




-Original Message-
From: [EMAIL PROTECTED] [mailto:delphi-
[EMAIL PROTECTED] On Behalf Of Neven MacEwan
Sent: Wednesday, 25 July 2007 8:19 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] basic question

Dennis


Class methods have been around since Delphi 2.  Where have you been
all these years?


Not explicitly, as I said, you cannot for example call them on the
class, you call them on a nil instance
which is hardly elegant php for example you would call a class method
by
TClass::Method()

To reinforce this, why did they introduce a 'class' keyword if they
were
already there?

N


Class types, consts and vars came in D2006, I think, or might be in
D2005.

- Original Message - From: Neven MacEwan [EMAIL PROTECTED]
To: NZ Borland Developers Group - Delphi List


delphi@delphi.org.nz


Sent: Wednesday, July 25, 2007 7:25 PM
Subject: Re: [DUG] basic question




J

My point is Delphi (generic) does not have Class Methods/Vars or
are you saying that 'Delphi' only applies to D2005+

As for sarcasm, its a matter of opinion I found his response smug.

N



I'll answer for Chee Wee (not Chee - common mistake)

These articles were by Nick about changes since Delphi 7.
http://dn.codegear.com/article/34325 (VCL)
http://dn.codegear.com/article/34323 (IDE)
http://dn.codegear.com/article/34324 (Language)

I don't think his original reply was sarcastic either. Why would he
need to clarify something, you're the one that didn't do any


research


before saying something. Especially when coming from a version that


is


like 6 years old
(http://delphi.wikia.com/wiki/Borland_Compiler_Release_Dates).

Even if you don't run the latest version, it is hardly a great


effort


to subscribe to some blogs (www.delphifeeds.com).

As for when they came in, they are a by product of Delphi.NET. So
codegear doing .NET was good for something! So they came into the
win32 around D2005 and have become less buggy each release since.

cheers,
Jeremy



Chee

When did they sneak in?, Before you get all sarcastic I'd suggest


you


clarify things,
Some of us are using older versions (D6 in my case)


___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject: unsubscribe




___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject: unsubscribe



___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject: unsubscribe




___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with
Subject: unsubscribe



___
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: 
unsubscribe






___
NZ Borland Developers Group - 

Re: [DUG]: Another custom component question

2003-11-16 Thread Dennis Chuah
Another custom component question
Why don't you simply create two components?

- Original Message -
From: [EMAIL PROTECTED]
To: Multiple recipients of list delphi
Sent: Friday, November 14, 2003 9:14 AM
Subject: [DUG]: Another custom component question


Hi all
I drop my custom TTable component on a form and I assign it a table name on
the object inspector. If I choose to name it, Policy, then I would like
certain methods to be exposed when I type Policy. However, if I name my
table, Adviser, then when I type Adviser. in code, I don't want the policy
methods to appear. At the moment all existing methods appear. Is there a way
to do this at design time, so if the user gives a table name of Policy, it
then unhides certain methods?
Thanks.
Dave Jollie
Developer, TOWER NZ IT

(: 09 368 4259
J: 09 306 6801
*: [EMAIL PROTECTED]
.: 46 Parnell Rd, Parnell, Auckland
---
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]: Packages problem

2003-11-16 Thread Dennis Chuah

Hmmm... strange problem.  The Clipbrd unit is quite small and simple, but
then again, you are dealing with a M$ product, so anything can happen.

As a hack, why don't you simply copy the unit and put that into your
package.  You will need to give it a new unit name as the unit name space is
global.

- Original Message -
From: Jason Coley
To: Multiple recipients of list delphi
Sent: Friday, November 14, 2003 11:25 AM
Subject: [DUG]: Packages problem


I have a com addin that works inside of Outlook, and this addin is linked to
a package which holds all of the Delphi runtime components I use and need
for all my addins, keeps my addins small.

Anyway, for some reason whenever I use the clipboard in the addin (the
ClipBrd unit is in the runtime package) Outlook crashes.

If I compile the addin without using the package it works fine.

Is there a way I can explicitly compile the ClipBrd unit into my com addin
to eliminate this problem, without taking it out of the runtime package, (I
tired to take it out of the runtime package but there are other units that
depend on the clipbrd unit which means I may have to take out a few other
units as well)

Not sure the best way to get around this problem, any help would be
appreciated.

Jason
---
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]: Freeing exceptions?

2003-11-16 Thread Dennis Chuah
Message Is the below code a memory leak?

 procedure TSam.Samuel;
 var
   e: Exception;
 begin
   e := Exception.Create('Foobar');
 end;

Yes, every time the method is called.

 Is the below code okay?

 procedure TSam.TrySamuel;
 var
   e: Exception;
 begin
   e := Exception.Create('Foobar');
   try
 //do some stuff
   finally
 e.Free;
   end;
 end;

Okay is subjective.  From a pure coding point of view, as long as e is not
used to raise any exceptions inside the try -- finally, the code is OK.
From a design point of view, it is IMHO, poor practise to create an
exception object and not raise it.  A class should do only one thing and do
it well.  So an exception class should only be used to raise exceptions, and
no more.  Create it when you need to use it.

Dennis.
---
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]: Menus.pas Delphi 5 'Attempt to free a non-existing resource'

2003-11-12 Thread Dennis Chuah

if FItemsnil then  FItems.Free;

does nothing more than FItems.Free

There is nothing wrong in that line of code - the items list is being
freed - if you are getting an exception there, it might indicate that you
are either freeing the menu twice, or there might have been some memory
corruption.

- Original Message -
From: Alistair George [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, November 13, 2003 11:32 AM
Subject: [DUG]: Menus.pas Delphi 5 'Attempt to free a non-existing resource'


 Hi all.
 I have found a destroy resource problem which is indicated to be in
menus.pas.

 destructor TMenuItem.Destroy;
 begin
   ShortCutItems.ClearItem(Self);
   if FParent  nil then
   begin
 FParent.Remove(Self);
 FParent := nil;
   end;
   while Count  0 do Items[0].Free;
   if FHandle  0 then
   begin
 MergeWith(nil);
 DestroyMenu(FHandle);
   end;
 //The offending line is 'FItems.Free;' which I changed to below
   if FItemsnil then  FItems.Free;
   FreeAndNil(FActionLink);
   FreeAndNil(FImageChangeLink);
   if FCommand  0 then CommandPool[FCommand] := False;
   if Assigned(FBitmap) then FBitmap.Free;
   inherited Destroy;
 end;

 but by changing the line to that creates a different problem.
 can you suggest what the correct way to free 'Fitems' would be given the
 circumstances thanks.
 Alistair+


 --
-
 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 do i GET this HTML...

2003-11-12 Thread Dennis Chuah

guesses
Perhaps you need to preserve cookies?
Perhaps the cgi / servlet only expects POST?
Are you having to go through a proxy server?
/guesses


- Original Message -
From: [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, November 12, 2003 2:41 PM
Subject: [DUG]: How do i GET this HTML...


 2 Questions really.
 1.
 I'm writting a component that will goto a defined webpage
 and download all the files from it based off the links in
 the html. This works fine with normal HTML but heres my
 problem. The page that i need it to work on is generating
 HTML via cgi or a Java servlet and when i use a GET on the
 page i am returned a 404 error. Goto the define URL in my
 browser and i get it fine. I get no html returned at all.
 What can i do?

 2. Other question is, where is the DUG page these days? I
 wanted to sign up for the list at work but cant seem to
 locate the page anymore.

 Regards,
 Matthew Evans
 --
-
 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]: Automated build tool for packages

2003-11-04 Thread Dennis Chuah

To open source, you first need to decide which open source license to use.
There are many variations, but essentially most of them boil down to
variants of either MPL or GPL.

You can create a project in SourceForge (http://sourceforge.net) - put your
code there and its effectively open source.

Not wanting to detract from your colleague's achievements, I wonder what is
the use of the software?  Doesn't Delphi automatically recompile all
dependent packages for you?

- Original Message -
From: Allan, Samuel [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 4:34 PM
Subject: [DUG]: Automated build tool for packages


A colleague at my work has written an automated builder which uses the
command line compiler to compile packages.

Given a root directory, it finds all the packages in subfolders. You can
then choose the ones that you want to compile. It sorts out the
dependencies between the packages and recompiles dependent packages as
well. It compiles them in the right order, sorts out all the other
complications (of which there are many).

I thought that maybe there were people other than us who would find such
a tool very useful. I also thought it would be nice kudos for him. I am
approaching our boss to see if it could be released outside of us. We
don't normally give / sell our software to other people.

If released it would most likely be source code, no support, but works
for us. Would anyone actually be interested? If a small sum of money was
required (a possibility because someone in the chain of command will
ask), would anyone pay it? If no money was required how would we go
about making it open source?
---
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]: Capturing input focus

2003-11-04 Thread Dennis Chuah
Message
TCustomControl is already a descendent of TWinControl.

Haven't had this happen to me before, but check the ControlState property.
Also how are you setting the focus to the control.  Try using the keyboard
(TAB key), or do it in code (SetFocus, ActiveControl).  Do you handle the
WM_NCHITTEST message and are setting the focus using the mouse?

- Original Message -
From: Wes Edwards
To: Multiple recipients of list delphi
Sent: Wednesday, November 05, 2003 7:37 AM
Subject: RE: [DUG]: Capturing input focus


Derive from TWinControl (Windows only) or TWidgetControl (cross-platform) to
receive focus / keyboard input etc.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Allan Vergara
Sent: Tuesday, 4 November 2003 2:01 p.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Capturing input focus


Been trying to figure this one out for a while now but still no luck.  What
I have is a TrackBar control derived from TCustomControl.  Within this
control I'm trying to trapping the messages WM_SETFOCUS and WM_KILLFOCUS but
this little experiment fails because these messages are not being sent to
this control (I've also set TabStop to TRUE). I need to trap these messages
in order to draw/remove a focusRect  on the Thumb (a TGraphicControl
control).  Thanks in advance.

Actual contol:


__
Allan D. Vergara
Software Engineer
Niche Software Ltd.
http://www.WorkPace.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/


Re: [DUG]: Just wondering...

2003-10-30 Thread Dennis Chuah

Actually, this is a misconception.  The compiler cannot fold the code
because Option.ItemIndex accesses a property, which translates to a method
call, and therefore can have side-effects.  (Yes folks, all property
accesses are method calls, even if no accessor methods are defined and the
property points directly at a variable.)  So, if the optimiser were to fold
the code, you would only get one method call instead of two!  The only time
when code is folder (and it is not even guaranteed), is when you directly
access variables.

- Original Message -
From: Rohit Gupta [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Friday, October 31, 2003 12:07 PM
Subject: Re: [DUG]: Just wondering...


 First because the compiler should detect it and fodl the code.

 Second because it uses less cpu cycles.

 :-)

 I normally use a local variable to hold teh value with a name that
 tells the world what it means.  Or

 if Option.ItemIndex = 1
 then begin
 end
 else begin
 end

 
  Which of the following codeis the most efficient/fastest to execute?
 
  Label1.Enabled := Option.ItemIndex = 1;
  Label2.Enabled := Option.ItemIndex = 1;
 
  or
 
  Label1.Enabled := Option.ItemIndex = 1;
  Label2.Enabled := Label1.Enabled;
 
  Thanks,
  Ross Levis.
 
 
 

 Regards

 Rohit

 ==
 CFL - Computer Fanatics Ltd.  21 Barry's Point Road, AKL, New Zealand
 PH(649) 489-2280
 FX(649) 489-2290
 email [EMAIL PROTECTED]  or  [EMAIL PROTECTED]
 ==


 --
-
 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]: Just wondering...

2003-10-30 Thread Dennis Chuah

Ross,

Using the local boolean variable is most efficient in terms of speed and
code/data space - this is because in *MOST* cases the optimiser will use a
CPU register to hold the local variable and this is not only faster than
calling methods, it also generates less code (one extra call is generated),
and being a register variable, there is no data storage.

However, the point I was trying to make is:  It is rather pointless trying
to optimise the code as it really doesn't matter which form you use - for 6
controls, the user isn't going to see any difference.  You might be able to
save a few bytes of code if you choose one technique over another, but once
again, IMHO, that is hardly worth it.  In this instance, I think it is
better to write and comment the code so that the meaning is clearly
represented.  Sometimes optimised code isn't the easiest to read.

Often it is one is tempted to try and optimise little snippets of code, but
if you really want to tweak your program, it is better to run it inside a
profiler.  You will be amazed at the results.  Often you will find that it
is the database / file access or some inefficient routine in a loop that
executes 2000 times that is slowing down your program.

Having said that, it doesn't hurt to use good algorithms, even if the gains
are not apparent.  This way, when it *DOES* matter, at least, you know that
your code will be fast.

Dennis.

- Original Message -
From: Ross Levis [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Friday, October 31, 2003 1:49 PM
Subject: Re: [DUG]: Just wondering...


 Hi Dennis (and others)

 So I presume you are suggesting the more efficient way is to repeat the
 itemindex = 1 expression.

 Options is usually a radio group, but sometimes it's a checkbox and using
 the checked property instead of itemindex = 1.

 Often it is more than 2 components I want enabled/disabled based on the
 Options selection.  There can be 6 for example, which is why I was
 interested to know the best way of coding it.  Not that the speed
difference
 would be noticeable but if one is more efficient than the other then why
not
 use it from now on.

 Is it more efficient to store the value in a local boolean variable before
 applying to several components?

 Regards,
 Ross.

 - Original Message -
 From: Dennis Chuah [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Friday, October 31, 2003 1:11 PM
 Subject: Re: [DUG]: Just wondering...


 
  Actually, this is a misconception.  The compiler cannot fold the code
  because Option.ItemIndex accesses a property, which translates to a
method
  call, and therefore can have side-effects.  (Yes folks, all property
  accesses are method calls, even if no accessor methods are defined and
the
  property points directly at a variable.)  So, if the optimiser were to
 fold
  the code, you would only get one method call instead of two!  The only
 time
  when code is folder (and it is not even guaranteed), is when you
directly
  access variables.
 
  - Original Message -
  From: Rohit Gupta [EMAIL PROTECTED]
  To: Multiple recipients of list delphi [EMAIL PROTECTED]
  Sent: Friday, October 31, 2003 12:07 PM
  Subject: Re: [DUG]: Just wondering...
 
 
   First because the compiler should detect it and fodl the code.
  
   Second because it uses less cpu cycles.
  
   :-)
  
   I normally use a local variable to hold teh value with a name that
   tells the world what it means.  Or
  
   if Option.ItemIndex = 1
   then begin
   end
   else begin
   end
  
   
Which of the following codeis the most efficient/fastest to execute?
   
Label1.Enabled := Option.ItemIndex = 1;
Label2.Enabled := Option.ItemIndex = 1;
   
or
   
Label1.Enabled := Option.ItemIndex = 1;
Label2.Enabled := Label1.Enabled;
   
Thanks,
Ross Levis.

 --
-
 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]: one for the MSDE people

2003-10-29 Thread Dennis Chuah
Message
SQL Server uses the same database structure as MSDE, so should be
compatible.

If you are not using any new stuff in MSDE2000, the database should be
backwards compatible.  I usually script the database and run the script
during installation.  You can also run MSDE / SQL server in backwards
compatible mode, so that way, you do not use the functions that are not
backwards compatible.

- Original Message -
From: Jeremy Coulter
To: Multiple recipients of list delphi
Sent: Thursday, October 30, 2003 8:34 AM
Subject: [DUG]: one for the MSDE people


Hi all.
With MSDE, how do you get on if the company already has SQL Server?
Also, what if they SQL Server, but tis say version 7, and you are using the
latest MSDE?

Cheers,

Jeremy Coulter



All email scanned with Nortons Antivirus 2003

---
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]: Delphi Testing Tools

2003-10-27 Thread Dennis Chuah

Gary,

Download MemProof - its pretty good for locating memory leaks.  GpProfiler
is a another pretty good product, except it does not do packages.

Dennis.

- Original Message -
From: GARY T BENNER [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Monday, October 27, 2003 2:28 PM
Subject: [DUG]: Delphi Testing Tools


Hi all,

I note that the Turbopower QA Suite has not been made Open Source, and their
website indicates it is not available anymore.

What other such tools are out there, and / or has someone else taken over
the product?

Looking for Memory leak testing, stress testing etc.

regards

Gary



Gary Benner  -  e-Engineer and Software Developer  -  [EMAIL PROTECTED]
   123 Internet Ltd
Lecturer in Information Technology-   Waiariki Institute of Technology



---
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]: IXMLDocument

2003-10-08 Thread Dennis Chuah

Download MSXML 4 from Microsoft (or get it from MSDN).  Version 4 has more
features and a few bugs fixed.  Install it and use Delphi to create a PAS
unit from the type library (msxml2_tlb).

// Include the PAS unit into your unit.
uses SysUtils, Classes, msxml2_tlb, Variants, ActiveX;

var
  dom: IXMLDomDocument2;
  root, node: ICMLDomNode;
  stm: TStream;
  istm: IStream;

begin
  dom := CoDOMDocument40.Create;
  // or if you need to access it from multiple threads then
  // dom := CoFreeThreadedDOMDocument40.Create;

  // Create the root node
  root := dom.CreateElement ('SomeTag');
  dom.documentElement := root;

  // Create other elements on the root...
  node := dom.CreateElement ('Node1');
  node.nodeValue := 'Some text'
  root.appendChild (node);

  node := dom.CreateElement ('Node2');
  node.nodeValue := 'Some other text'
  root.appendChild (node);

  // Show the XML
  ShowMessage (root.xml);

  // Save the XML
  stm := TFileStream.Create ('test.xml', fmCreate);
  istm := TStreamAdapter.Create (stm, soOwned);
  dom.save (istm);
  istm := Nil; // Close the file

- Original Message -
 Has anyone had any experience using this to create an XML document from
 scratch ?
---
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]: Fw: MSDE tool

2003-10-07 Thread Dennis Chuah

A batch in SQL server is basically one or more queries executed in series by
one database connection.


- Original Message -
From: Robert martin [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 11:49 AM
Subject: Re: [DUG]: Fw: MSDE tool


 I have just checked the Microsoft site for information and spotted the
 following.

 MSDE 2000 is a local data engine that can be shared. It has a managed
 concurrency workload governor that limits up to five concurrent batch
 workloads for optimal performance. Commands and log entries are available
to
 monitor instances where more than five workloads are executed
concurrently,
 a situation that can cause slower performance even on well-tuned systems.
As
 more batch workloads are submitted beyond the five-workload limit, the
 concurrency governor continues to slow down the system. These workloads
are
 not dropped or lost; they are still processed, but in an increasingly
 degraded performance mode. If your solution must support more than five
 concurrent workloads, it is highly recommended that you migrate to SQL
 Server 2000 or SQL Server 2000 Enterprise Edition for optimal performance
at
 this higher level of scalability.


 I had taken 'five concurrent batch workloads' to mean users but it might
be
 concurrent queries or maybe complex queries count as multiple batches?


 Rob Martin
 Software Engineer

 phone 03 377 0495
 fax 03 377 0496
 web www.chreos.com
 - Original Message -
 From: Neven MacEwan [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Tuesday, October 07, 2003 11:33 AM
 Subject: Re: [DUG]: Fw: MSDE tool


  Robert
 
  As I said I've not experianced this (and i have
  a site running 10+ users on MSDE with a financials package)
  The only performance hit I've had is on joined queries
 
  N
  - Original Message -
  From: Robert martin [EMAIL PROTECTED]
  To: Multiple recipients of list delphi [EMAIL PROTECTED]
  Sent: Tuesday, October 07, 2003 11:12 AM
  Subject: Re: [DUG]: Fw: MSDE tool
 
 
   I believe the deal with MSDE is that it IS throttled to give very poor
   performance with more than 5 connections.  I heard it was something
like
 a
   50% drop for each user over 5.
  
   Rob Martin
   Software Engineer
  
   phone 03 377 0495
   fax 03 377 0496
   web www.chreos.com
   - Original Message -
   From: Neven MacEwan [EMAIL PROTECTED]
   To: Multiple recipients of list delphi [EMAIL PROTECTED]
   Sent: Tuesday, October 07, 2003 10:45 AM
   Subject: [DUG]: Fw: MSDE tool
  
  
Alan
   
Yeah, i'm happy for it to go into the public domain
(We don't realy want to support it), It uses virtualtreeview
and is a warpper for the SQL-DMO Objects
   
I'd prefer to keep it under subversion (so everyone
benfits from changes) so if anyone else would like access to it I'll
 set
   up
a public domain repository (email me off list)
   
Re the licencing, I think its pretty loose (I've not
worried to much) from what I've read on ADO
newgroup M$ just want it out there as a launching pad
for full SQL, AFAIK its NOT user limitied but the only
problems I've had have been performance on relatively
simple queries over multiple tables (3 to 4) on large
databases, 1 query ran 32 seconds on SQL 7, 20+ minutes on
MSDE (same database, same memory and CPU),
Almost as if the thing was throttled (do do do do spooky noise)
My theory is that M$ made it this way because when it
is backended to Access the query opt would be done by
Jet (and MSDE would act as a glorified ISAM) but it
prevents you from using it in serious DB applications
   
HTH
   
Neven
   
   
   
- Original Message -
From: Allan, Samuel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 10:27 AM
Subject: MSDE tool
   
   
 Hi Neven,

 I am interested in your MSDE tool because I am also looking at
using
 MSDE. Is it free? Can I have it?

 On another note, I have been looking at the licensing guff on the
 Micrsoft website, and I am confused. Perhaps you know off the top
of
 your head what I have to buy to be able to re-distribute MSDE as
 part
  of
 my software, and if I can then develop in Delphi instead of
whatever
 I
 bought?

 Thanks,
 Samuel Allan


  
 

 --
   -
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]
 

Re: [DUG]: Fw: MSDE tool

2003-10-07 Thread Dennis Chuah

Rob,

You as a programmer decide what is a batch.  Every time you execute a query
against SQL server, it is one batch - within reason, size does not matter -
it can be one simple statement, one complex statement or multiple
statements.  The only limitations are stored procedure and function creation
/ alter statements must be the first in the batch.

If you use query analyser, anything between GO statements is a batch.
Internally, it splits the query on the GO statements into multiple queries
and issues each query in sequence to SQL server.

I cannot comment on 100 users using MSDE because you shouldn't be using it
for anything other than a few concurrent users.  With that sort of a number,
you should be using SQL server instead.

I suspect internally, the thread manager only allows 5 threads, so if you
already have 5 batches running, the other will have to wait until a thread
is free.  Its only a suspicion though - I have no concrete proof.

Regards,
Dennis.

- Original Message -
From: Robert martin [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, October 08, 2003 2:02 PM
Subject: Re: [DUG]: Fw: MSDE tool


 Thanks Dennis

 Any idea how big a gap between the SQL is required for it to count as a
new
 batch?  So I can have 100 users each doing and Query every now and then
 without any performance hit?


 Rob Martin
 Software Engineer

 phone 03 377 0495
 fax 03 377 0496
 web www.chreos.com
 - Original Message -
 From: Dennis Chuah [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Wednesday, October 08, 2003 1:41 PM
 Subject: Re: [DUG]: Fw: MSDE tool


 
  A batch in SQL server is basically one or more queries executed in
series
 by
  one database connection.
 
 
  - Original Message -
  From: Robert martin [EMAIL PROTECTED]
  To: Multiple recipients of list delphi [EMAIL PROTECTED]
  Sent: Tuesday, October 07, 2003 11:49 AM
  Subject: Re: [DUG]: Fw: MSDE tool
 
 
   I have just checked the Microsoft site for information and spotted the
   following.
  
   MSDE 2000 is a local data engine that can be shared. It has a managed
   concurrency workload governor that limits up to five concurrent batch
   workloads for optimal performance. Commands and log entries are
 available
  to
   monitor instances where more than five workloads are executed
  concurrently,
   a situation that can cause slower performance even on well-tuned
 systems.
  As
   more batch workloads are submitted beyond the five-workload limit, the
   concurrency governor continues to slow down the system. These
workloads
  are
   not dropped or lost; they are still processed, but in an increasingly
   degraded performance mode. If your solution must support more than
five
   concurrent workloads, it is highly recommended that you migrate to SQL
   Server 2000 or SQL Server 2000 Enterprise Edition for optimal
 performance
  at
   this higher level of scalability.
  
  
   I had taken 'five concurrent batch workloads' to mean users but it
might
  be
   concurrent queries or maybe complex queries count as multiple batches?
  
  
   Rob Martin
   Software Engineer
  
   phone 03 377 0495
   fax 03 377 0496
   web www.chreos.com
   - Original Message -
   From: Neven MacEwan [EMAIL PROTECTED]
   To: Multiple recipients of list delphi [EMAIL PROTECTED]
   Sent: Tuesday, October 07, 2003 11:33 AM
   Subject: Re: [DUG]: Fw: MSDE tool
  
  
Robert
   
As I said I've not experianced this (and i have
a site running 10+ users on MSDE with a financials package)
The only performance hit I've had is on joined queries
   
N
- Original Message -
From: Robert martin [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 11:12 AM
Subject: Re: [DUG]: Fw: MSDE tool
   
   
 I believe the deal with MSDE is that it IS throttled to give very
 poor
 performance with more than 5 connections.  I heard it was
something
  like
   a
 50% drop for each user over 5.

 Rob Martin
 Software Engineer

 phone 03 377 0495
 fax 03 377 0496
 web www.chreos.com
 - Original Message -
 From: Neven MacEwan [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Tuesday, October 07, 2003 10:45 AM
 Subject: [DUG]: Fw: MSDE tool


  Alan
 
  Yeah, i'm happy for it to go into the public domain
  (We don't realy want to support it), It uses virtualtreeview
  and is a warpper for the SQL-DMO Objects
 
  I'd prefer to keep it under subversion (so everyone
  benfits from changes) so if anyone else would like access to it
 I'll
   set
 up
  a public domain repository (email me off list)
 
  Re the licencing, I think its pretty loose (I've not
  worried to much) from what I've read on ADO
  newgroup M$ just want it out

Re: [DUG]: Moving to MSDE

2003-10-07 Thread Dennis Chuah

You do not have to develop in SQL server, you can use MSDE.  Install the SQL
server client tools that come with Small Business Server - the client
installation is separate from the server install.

- Original Message -
From: Robert martin [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 10:38 AM
Subject: Re: [DUG]: Moving to MSDE


 We are also looking at doing a package that uses MSDE (for small sites),
Do
 you have to develop using SQL Server 7?  We have a copy of it included
with
 Small Business Server 4.5 (believe it or not :) ), but don't want to
install
 that just to Get SQL Server 7.

 Rob Martin
 Software Engineer

 phone 03 377 0495
 fax 03 377 0496
 web www.chreos.com
 - Original Message -
 From: Neven MacEwan [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Tuesday, October 07, 2003 10:32 AM
 Subject: Re: [DUG]: Moving to MSDE


  J
 
  Develop using SQL Server 7, Then you just install the MSDE package
  on the client site, Network performance will always be better than an
  isam even indexed
 
  N
 
  - Original Message -
  From: Jeremy Coulter [EMAIL PROTECTED]
  To: Multiple recipients of list delphi [EMAIL PROTECTED]
  Sent: Tuesday, October 07, 2003 10:24 AM
  Subject: RE: [DUG]: Moving to MSDE
 
 
   Whats its performance like over a network? This is one area that
DBISAM
   is not so flash. Well its OK, but I have a table that I have had to
put
   5 or is it 6 indexes onto to speed up querys that run in an instant
   locally.
  
   Also, how exactly do you get started with MSDE?
   Do you basically do everything in SQLServer then export it?
   Maybe you have a site I can look at?
  
   Thanks, Jeremy
  
   -Original Message-
   From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On
   Behalf Of Neven MacEwan
   Sent: Tuesday, 7 October 2003 10:21
   To: Multiple recipients of list delphi
   Subject: Re: [DUG]: Moving to MSDE
  
  
   J
  
   Its v simple, In my experiance MSDE is indistinguishable from SQL 7
The
   one caveate is that some queries will run slower, they have removed
some
   of the query opt stuff from MSDE, I use a kbmMemtable loaded from ADO
   and my own resolver
  
   Also if you want to manage an MSDE site we have an 'Enterprise
manager'
   like tool which you are welcome to
  
   HTH
  
   Neven
  
   - Original Message -
   From: Jeremy Coulter [EMAIL PROTECTED]
   To: Multiple recipients of list delphi [EMAIL PROTECTED]
   Sent: Tuesday, October 07, 2003 9:49 AM
   Subject: [DUG]: Moving to MSDE
  
  
HI all.
At the moment I have a project where I am using the evaluation
version
  
of DBISAM. It does everything I want it to do, its fast compact, and
I
  
REALLY like it !
   
BUT, after using MSSQL for so long, I miss stored proc.s and now
have
a situation where a Stored Proc would solve a problem. I am thinking
that the move to MSDE might be an idea. Ok, its prob. a LOT of work,
but really,  I am wondering how well MSDE interacts with Delphi, and
if it IS worth it, um...hehehewhere do I start ? hehehe
   
   
Cheers,
   
Jeremy Coulter
   
   
  
 --
--
All email scanned with Nortons Antivirus 2003
   
 
 
   
   
  
 
 
   ---
   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 - 

Re: [DUG]: Frames

2003-10-02 Thread Dennis Chuah

When you create the frame at run time, set the owner of the frame to the tab
sheet.

- Original Message -
From: Paul Mckenzie
To: Multiple recipients of list delphi
Sent: Friday, October 03, 2003 8:55 AM
Subject: [DUG]: Frames


I have an Application in which I create and delete TabPages dynamically -
the Tab Pages contain a Frame which I create at Run Time.
To do this the Name of the Frame must be set to ''.
I can set the name to '' at design time (Object Inspector) - but I cannot
save it ... each time I re-open the Frame the Name is set to the class name.
How can I fix this bug !!!


Regards
Paul McKenzie
Analyst Programmer
SMSS 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
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


Re: [DUG]: random thread crashes

2003-09-24 Thread Dennis Chuah

Using synchronize does not negate the benefits of using a thread.  It all
depends on how you are using synchronize.  For example, you might have a
lengthy process and you want that to run in the background.  When you create
the thread - in suspend mode, you can pass it parameters (eg. create
properties on the TThread subclass).  You then tell the thread to resume.
On your UI, you might have a cancel button that when clicked, sets a boolean
variable.  Periodically, the thread may check the value of this variable and
terminates if required.  You can protect access to this variable using a
simple critical section lock.  However, the thread also needs to tell the UI
when it has complete.  This can be done using synchronize - the sync. method
runs in the main thread and can safely access the VCL.

How much data does the thread need to read from your UI controls?

- Original Message -
From: Ross Levis [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, September 24, 2003 3:40 PM
Subject: Re: [DUG]: random thread crashes


 Hi Dennis

 Using synchronize will negate the effect of using a thread in the first
 place.  I'm not using any methods but I am reading properties.  Should I
 copy the value of all properties into say global variables before calling
 the thread?

 Regards,
 Ross Levis.

 - Original Message -
 From: Dennis Chuah [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Wednesday, September 24, 2003 2:02 PM
 Subject: Re: [DUG]: random thread crashes


 
  The VCL is not thread safe and parts of it are not re-entrant.  You
might
  need to use synchronize to sync to your main thread before you call any
 VCL
  methods.

 --
-
 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]: ImageList images

2003-09-24 Thread Dennis Chuah
Message
Not sure if this will fix your problem, but there is a bug in the VCL - when
toolbars are loaded in a form, in some instances, the associated image list
becomes unassigned.  The workaround is to reassign the image list in the
FormShow - but only do it once per form.

- Original Message -
From: Phil Middlemiss
To: Multiple recipients of list delphi
Sent: Thursday, September 25, 2003 1:41 PM
Subject: [DUG]: ImageList images


I have a form in a DLL that has an action list and an associated image list.
When I use the actions on toolbar buttons (or anything else, I think) - the
images don't appear. The DLL form has it's own TApplication even though it's
loaded into the same memory space as the main app and I hade to take that
into account to pass on the On Idle event to the DLL so that actions could
update their status. But I can't seem to get the image list to show. Any
ideas?

Cheers,
Phil.
---
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]: random thread crashes

2003-09-23 Thread Dennis Chuah

The VCL is not thread safe and parts of it are not re-entrant.  You might
need to use synchronize to sync to your main thread before you call any VCL
methods.

- Original Message -
From: Ross Levis
To: Multiple recipients of list delphi
Sent: Wednesday, September 24, 2003 11:52 AM
Subject: [DUG]: random thread crashes


I moved a procedure, which updates a text file, from my main unit to a
thread so it didn't effect the operation of the program.  The thread reads
data from the main units object including some data in a listview in the
main unit, but it doesn't update any information.  I'm getting the odd rare
crash when the thread is created/run.  I'm testing that the thread is not
active before it gets run.  Do I need to move all the data I'm using from
the main unit to temporary variables before calling the thread?  It can work
50 times without a problem but then crashes out of the blue.

Any ideas?

Best regards,

Ross Levis
Tauranga.

StationPlaylist.com
http://www.stationplaylist.com
Low-cost music scheduling, live assist  automation software.
Mailing List: http://groups.yahoo.com/group/StationPlaylist

---
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]: Form size changing/scrolling?

2003-09-18 Thread Dennis Chuah

Sounds like you may have a font size / scaling issue.  Can you try setting
the form's Scaled property to False.  This will display the form and its
controls at the same size as when they were designed, but the controls may
clip data - because the font size may be different.

Alternatively, you may want to set the form's AutoSize property to True -
this will resize the form so that all controls are visible.  This works if
the form is designed like a dialogbox, with fixed controls.

Dennis.

- Original Message -
From: Chris Veale [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 8:47 AM
Subject: [DUG]: Form size changing/scrolling?


 Hi all.

 I have created a program that runs fine on desktop computers but when it
is
 run on laptops the forms do something weird and the user now has to scroll
 them to see the full screen.

 the first form I display is only 400 x 200 pixels but no matter what
 resolution the laptop is set to the user has to scroll, even if its 1400 x
 1080 resolution and the form is small in the center of the screen -
without
 having a need (technically) to scroll.

 Can anyone suggest a solution to this?  I've never come across this
before.

 Cheers

 Chris Veale

 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.518 / Virus Database: 316 - Release Date: 11/09/03




 __
 The contents of this e-mail are privileged and/or confidential to the
 named recipient and are not to be used by any other person and/or
 organisation. If you have received this e-mail in error, please notify
 the sender and delete all material pertaining to this e-mail.
 __
 --
-
 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]: Sharing a drawing surface

2003-09-18 Thread Dennis Chuah

 1) use a plugin DLL - works, but a bit ugly since the forms used in the
DLL
 have to StayOnTop and are producing similar errors to the other thread
where
 things like FileOpen dialogs are being hidden behind the DLL forms.

The NormaliseTopMosts and RestoreTopMosts methods should fix this problem -
see Delphi help for more info.

You can perhaps move your Active-X server into a DLL and register it.  There
should be no code change required for the client because you would be using
the ProgID to create an instance of the server, and when you do that, OLE
will load the DLL for you.  This is your in-process server!

Dennis.

- Original Message -
From: Phil Middlemiss [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 8:48 AM
Subject: Re: [DUG]: Sharing a drawing surface


 Thanks Dennis,

 The situation is that a plugin wants to annotate the drawing surface. I've
 explored 2 options:

 1) use a plugin DLL - works, but a bit ugly since the forms used in the
DLL
 have to StayOnTop and are producing similar errors to the other thread
where
 things like FileOpen dialogs are being hidden behind the DLL forms.

 2) use a separate exe that connects to the main program via an ActiveX
 server inside the main program. This doesn't give me access to the drawing
 surface anymore.

 I probably should have explained that earlier. I can't make the plugin an
 in-process ActiveX server since the main program only finds out at run
time
 what plugins there are (looks for files in a directory). Is that what you
 meant?

 Phil.
 - Original Message -
 From: Dennis Chuah [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Thursday, September 18, 2003 7:19 AM
 Subject: Re: [DUG]: Sharing a drawing surface


 
  Phil,
 
  You cannot share a DC between different processes - because they are in
  different address space.  However, you can try to FindWindow to look for
 the
  window handle, and obtain a DC to paint on its surface.
 
  The other suggestion is to use an in-process (ie Active-X DLL) server.
 
  Dennis.
 
  - Original Message -
  From: Phil Middlemiss [EMAIL PROTECTED]
  To: Multiple recipients of list delphi [EMAIL PROTECTED]
  Sent: Wednesday, September 17, 2003 1:16 PM
  Subject: [DUG]: Sharing a drawing surface
 
 
   Apologies if you get this twice but I think our mail server swallowed
it
  the
   first time I sent it:
  
   Does anyone know how to share a device context for drawing between
  separate
   programs? Is it possible at all? I have tried passing the handle to
the
   context using an ActiveX connection so that a separate program can
  annotate
   an image but even though the correct handle value is passed, none of
the
   annotation code seems to have any effect (the drawing code itself
works
   fine - I've tested that separately).
  
  
   Any help would be appreciated.
  
   Cheers,
   Phil.
  
 

 --
  -
   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]: Sending emails with Outlook

2003-09-18 Thread Dennis Chuah

Jason,

I'm afraid you'd say that.  I'll be grateful for your code snippets - they
would be most helpful.

Thanks,
Dennis.

- Original Message -
From: Jason Coley [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 8:40 AM
Subject: RE: [DUG]: Sending emails with Outlook


Ive been writing Exchange Extensions for a few years now and the only
way that works and is guaranteed to work is using Extended MAPI, I could
maybe send you some snippets of code that may help?

Regards

Jason Coley
Manawatu Software Solutions
email: [EMAIL PROTECTED]
web: http://www.software-solutions.co.nz



-Original Message-
From: Dennis Chuah [mailto:[EMAIL PROTECTED]
Sent: Thursday, 18 September 2003 7:29 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Sending emails with Outlook


Folks,

I am currently using automation to send emails using Outlook (no, I am
not
writing the next killer virus) and it works fine.  But with the security
upgrade and Outlook 2002, Outlook pops up a series of confirmation
dialog
boxes (presumably to allow the user to stop virii from using Outlook to
propagate).  This also happens if you try to do a mail merge from Word.

I have searched Google and some of the workarounds are:

1.  Disable the security feature in Exchange - No!
2.  Use a USD199 Active-X component that reputedly blocks the messages -
it
blocks the messages but does not seem to send the email - Duh!
3.  Use extended MAPI - complex and convoluted API, as a last resort?

I cannot use SMTP because it is an optional install on exchange servers
and
some people see it as a security hole.

Any other ideas, anyone?

TIA,
Dennis.

---
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]: Email questions

2003-09-18 Thread Dennis Chuah
Ah, another virus author... :)

SMTP should be as reliable (or unreliable as the case may be) as MAPI,
because at end of the day, SMTP is the mechanism where emails are forwarded
in the internet, and SMTP does not guarantee delivery.  In fact, there is
also no guarantee that you will get a bounced email because of no delivery.
Worse still, you can get a bounced email, yet the email is delivered.  I.e.,
you don't know whether the email is ever delivered.  Some say email was
modeled after postal mail!

The one problem with using SMTP is not all exchange servers are installed
with SMTP, but this may not be a problem with you case, if you are sending
email from the lab.

If you use automation or CDO to send emails using Outlook, there is no way
to alter the from address, but you can do that with extended MAPI.

Dennis.
(Also in Parnell)

- Original Message -
From: [EMAIL PROTECTED]
To: Multiple recipients of list delphi
Sent: Thursday, September 18, 2003 1:12 PM
Subject: [DUG]: Email questions


Hi all

I recently moved an app from using MAPI with Outlook, to using SMTP. My
reasons were 2-fold. To get around the Outlook prompt - A program is trying
to send an email on your behalf. This could be a virus. Do you want to allow
this? My other reason, was that it's a batch app which sends 100's of
emails out to our advisers and I didn't want the from address to be the
developers email, where the app was run. (With SMTP I could define the from
address).

Now I have a concern. One email I read recently made me wonder if SMTP is as
reliable as MAPI - in getting bulk emails out successfully without failure.

My questions:
Is MAPI more reliable than SMTP?
Can the from be forced to a different address using MAPI?

Any comments appreciated.

Cheers
Dave Jollie
Developer, TOWER NZ IT
(: 09 368 4259
J: 09 306 6801
*: [EMAIL PROTECTED]
.: 46 Parnell Rd, Parnell, Auckland
---
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]: Sharing a drawing surface

2003-09-17 Thread Dennis Chuah

Phil,

You cannot share a DC between different processes - because they are in
different address space.  However, you can try to FindWindow to look for the
window handle, and obtain a DC to paint on its surface.

The other suggestion is to use an in-process (ie Active-X DLL) server.

Dennis.

- Original Message -
From: Phil Middlemiss [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, September 17, 2003 1:16 PM
Subject: [DUG]: Sharing a drawing surface


 Apologies if you get this twice but I think our mail server swallowed it
the
 first time I sent it:

 Does anyone know how to share a device context for drawing between
separate
 programs? Is it possible at all? I have tried passing the handle to the
 context using an ActiveX connection so that a separate program can
annotate
 an image but even though the correct handle value is passed, none of the
 annotation code seems to have any effect (the drawing code itself works
 fine - I've tested that separately).


 Any help would be appreciated.

 Cheers,
 Phil.

 --
-
 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]: Sending emails with Outlook

2003-09-17 Thread Dennis Chuah

Folks,

I am currently using automation to send emails using Outlook (no, I am not
writing the next killer virus) and it works fine.  But with the security
upgrade and Outlook 2002, Outlook pops up a series of confirmation dialog
boxes (presumably to allow the user to stop virii from using Outlook to
propagate).  This also happens if you try to do a mail merge from Word.

I have searched Google and some of the workarounds are:

1.  Disable the security feature in Exchange - No!
2.  Use a USD199 Active-X component that reputedly blocks the messages - it
blocks the messages but does not seem to send the email - Duh!
3.  Use extended MAPI - complex and convoluted API, as a last resort?

I cannot use SMTP because it is an optional install on exchange servers and
some people see it as a security hole.

Any other ideas, anyone?

TIA,
Dennis.
---
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]: Button Caption

2003-08-31 Thread Dennis Chuah

Not sure if this will work, but it is worth a try.  Create a sub-class of
TButton and override the CreateParams method:

procedure TButtonNew .CreateParams(var Params: TCreateParams);
begin
  inherited;

  Params.Style := Params.Style or BS_LEFTTEXT;
end;

BS_LEFTTEXT is declared in the Windows unit.

- Original Message -
From: Ross Levis [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Sunday, August 31, 2003 8:54 PM
Subject: Re: [DUG]: Button Caption


 Ross Levis wrote:
 Is there an easy way to left justify a TButton caption

 Rohit Gupta wrote:
  Its possible but will take you hours to find it look  at the VCL
  code for TBitBtn and then try to copy the relevant bits into TButton.
  Or start with TPanel and make your own button component.

 TPanel in D5 must not use standard Windows controls either.  It doesn't
show
 with the new rounded edges and colors etc.  Most of the D5 components do.

 I'm trying to follow the VCL code but I can't find where the caption is
 updated using the Windows API.  Buttons don't appear to have a canvas.
Can
 anyone point me in the right direction?  Or is it basically impossible.

 Regards,
 Ross.

 --
-
 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 do I copy the state of one object to another?

2003-08-28 Thread Dennis Chuah
Yes, use RTTI - here is a simple example:

type
 TDog = class (TComponent)
 private
   FColour: TColor;
   FSize: Integer;
 published
   property Colour: TColor read FColor write FColor;
   property Size: Integer read FInteger write FInteger;
 end;
To clone this, you simply:

var
 stm: TTStream;
 dog1, dog2: TDog;
begin
 stm := TMemoryStream.Create;
 try
   stm.WriteComponent (dog1);
   stm.Seek (0, 0);
   stm.ReadComponent (dog2);
 finally
  stm.Free;
 end;
And BTW, I disagree that using RTTI breaks under different versions of 
Delphi - in fact, this code runs on *ALL* versions of Delphi!  I wonder why 
Borland didn't write a generic Assign method using this!

Dennis.

From: Neven MacEwan [EMAIL PROTECTED]
Dave
You could use RTTI, There are some good tutorials
around
google Delphi RTTI

Neven

- Original Message -
From: [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 4:50 PM
Subject: [DUG]: How do I copy the state of one object to another?
 Hi all



 I want to copy the state (variables) of one instance object of a class, 
to
 another instance object of the same class. Eg. Class TDog, instance Dog1
and
 Dog2. I could do the following:

 Dog2.Colour := Dog1.Colour;

 Dog2.Breed := Dog1.Breed;etc.

 But this seems a little silly. How do I do this in OO?



 If knowing more would be helpful, here's what I'm doing:



 I'm using ICS to connect to an smtp server and want to make multiple
 connections so that I can offload 4000 emails as quickly as possible,
 leaving the smtp server to send them out. (No I'm not a spammer, this is 
a
 report - email with pdf attachment).



 I've just run a test and I can paste multiple ICS components on my form
i.e.
 SmtpCli1, SmtpCli2, SmtpCli3, etc. And I can assign my email details 
into
 SmtpCli1 as my holder' object. When I go to send, I see if SmptCli2 is 
in
a
 ready state - if so, I copy all of the details from SmtpCli1 to SmtpCli2
and
 send via Cli2. Else, I try SmtpCli3, etc. Using this method, and keeping 
5
 sessions active, I found it sped up my job 5 fold - so seems worth it.



 So this all works but it's very manual with lots of code. How do I do 
this
 with OO elegance?



 Cheers

 Dave Jollie
 Developer, TOWER NZ IT

 *: 09 368 4259
 *: 09 306 6801
 *: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
 *: 46 Parnell Rd, Parnell, Auckland





---
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/
_
Gaming galore at  http://xtramsn.co.nz/gaming !
---
   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]: GetMenuBarInfo

2003-08-25 Thread Dennis Chuah

Pass the form's handle, not the menu bar's.

- Original Message - 
From: Vaughan, Benjamin Carl [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Monday, August 25, 2003 1:11 PM
Subject: [DUG]: GetMenuBarInfo


Hi,

I am currently attempting to get the size of a Menu using the windows
API method GetMenuBarInfo.

My code is as follows

var
  menuInfo: tagMENUBARINFO;
  res : longbool;
begin
  //tbMenu is the TToolbar that TMainMenu is hooked up to
  res := GetMenuBarInfo(tbMenu.Handle,OBJID_MENU,0,menuInfo)
end;

The method is failing and GetLastError is only giving me the extremely
useful message of The parameter is incorrect. ,
ERROR_INVALID_PARAMETER.

Does anybody have any idea what would be wrong with this piece of code,
or has anyone used this method before?

Regards
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/
---
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]: Best methods for representing a 3 dimensional array

2003-08-14 Thread Dennis Chuah

There is probably no generic best method - it all depends on what you want
to do with the data.  A few examples are:

1.  Use dynamic arrays like you suggested.  This is simple and does not
violate any OO programming methodologies.  Ie., it is OK to use dynamic
arrays with OO.

2.  Use TStringList.  The first string list would hold Q1, Q2, etc.  For
each Q1, Q2, etc, you attach another string list to hold X1, X2, etc.  Eg.

var
  MainList, SubList, SubSubList: TStringList;

begin
  MainList := TStringList.Create;

  SubList := TStringList.Create;
  MainList.AddObject ('Q1', SubList);

  SubSubList := TStringList.Create;
  SubList.AddObject ('X1', SubSubList);

  SubSubList.Add ('F1');
  SubSubList.Add ('F2');

  SubList := TStringList.Create;
  MainList.AddObject ('Q2', SubList);

Remember to free the sublists when you free the main list.

3.  Use the composite pattern.

type
  TItem = class (TObject);

  TContainer = class (TItem)
  private
FChildren: TList;
  end;

  TData = class (TContiner)
  private
FData: string;
  end;

4.  Use TCollection

type
  TDataItem = class (TColletionItem)
  private
FChildren: TCollection;
FData: string;

  public
constructor Create (ACollection: TCollection);
property Children: TCollection read FChildren;
property Data: string read FData write FData;
  end;

constructor TDataItem.Create (ACollection: TCollection);
begin
  inherited;

  FChildren := TCollection.Create (TDataItem);
end;

to add items...

var
  Root: TCollection;

begin
  Root := TCollection.Create (TDataItem);
  with TDataItem (Root.Add) do begin
Data := 'Q1';
with TDataItem (Children.Add) do begin
  Data := 'X1';
  TDataItem (Children.Add).Data := 'F1';
  TDataItem (Children.Add).Data := 'F2';
end;
  end;

- Original Message -
From: [EMAIL PROTECTED]
To: Multiple recipients of list delphi
Sent: Wednesday, August 06, 2003 7:29 AM
Subject: [DUG]: Best methods for representing a 3 dimensional array


Morning all,

I need to code a structure that looks like this:

Q1 --- X1 --- F1
  --- F2
  --- F3
 --- X2  F1

Q2 -- X2 --- F1

i.e. For every Q (highest level), there can be multiple X's. For every X,
there can be multiple F's (lowest level). I want to create this structure
and then be able to traverse it. E.g. Q1, X1, F1, then Q1, X1, F2, etc.
right through the whole structure. Each Q, X, and F, are purely a string.

I thought about using a multidimensional dynamic array and using Delphi help
could probably get this working. However, I'm new to Windows programming (1+
yrs) and want to learn OO. I've written a couple of objects recently, so
thought I might try to tackle this as a Q object which has multiple X
objects inside it, and then multiple F objects inside the X objects.

I've started reading about collections and trying some sample code, but
don't know enough to create a collection within a collection, or even if
that's a correct concept.

Any comments or suggestions? Would a TObjectList be better? Should I just
stick to an array?

TIA
Dave Jollie
Developer, TOWER NZ IT
(: 09 368 4259
J: 09 306 6801
*: [EMAIL PROTECTED]
.: 46 Parnell Rd, Parnell, Auckland
---
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]: Best methods for representing a 3 dimensional array

2003-08-09 Thread Dennis Chuah

It could also be a Graph structure - the child may need to know about its
parent.  It all depends on how the data is going to be used, but lets not
confuse Dave too much :).

- Original Message -
From: Leigh Wanstead
To: Multiple recipients of list delphi
Sent: Wednesday, August 06, 2003 9:37 AM
Subject: RE: [DUG]: Best methods for representing a 3 dimensional array


Hi Dave,

I still want to make a suggestion even you decided which way to go.

I thought that is a tree structure. There are lots of options around tree,
i.e. Microsoft DOM tree.

Regards
Leigh
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 9:00 AM
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Best methods for representing a 3 dimensional array


Thanks Dennis and Phil. Your replies were very helpful - now to decide which
way to go...

Cheers
Dave Jollie
Developer, TOWER NZ IT
(: 09 368 4259
J: 09 306 6801
*: [EMAIL PROTECTED]
.: 46 Parnell Rd, Parnell, Auckland
-Original Message-
From: Phil Middlemiss [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 6 August 2003 8:44AM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Best methods for representing a 3 dimensional array

It really depends upon the architecture it is fitting into, and whether you
are likely to want to reuse such a structure in other projects, or elsewhere
in the same project. It would probably be worthwhile you doing as OO anyway
just to get a bit of practice in.

I would use a base class that had all of the parent-child behaviour already
implemented. For example:

// forward declare this so that we can declare the TParentChildClass;
TParentChild = class;
TParentChildClass = class of TParentChild;

// finish declaring this
TParentChild = class
private
  FOwner : TParentChild;
  FChildClass : TParentChildClass;
  FChildList : TList;
protected
  function GetChild(Index : Integer): TParentChild;
  Property ChildClass : TParentChildClass read FChildClass write
FChildClass;
public
  function AddChild : TParentChild;
  procedure RemoveChild(Index : Integer; FreeChild : Boolean);
  function ChildCount : Integer;
  property Child[Index : Integer] : TParentChild read GetChild;
end;

This is just a rough outline really, you will want to add or change the
functionality depending on what you want to acheive.

Phil.
- Original Message -
From: [EMAIL PROTECTED]
To: Multiple recipients of list delphi
Sent: Wednesday, August 06, 2003 7:29 AM
Subject: [DUG]: Best methods for representing a 3 dimensional array

Morning all,

I need to code a structure that looks like this:

Q1 --- X1 --- F1
  --- F2
  --- F3
 --- X2  F1

Q2 -- X2 --- F1

i.e. For every Q (highest level), there can be multiple X's. For every X,
there can be multiple F's (lowest level). I want to create this structure
and then be able to traverse it. E.g. Q1, X1, F1, then Q1, X1, F2, etc.
right through the whole structure. Each Q, X, and F, are purely a string.

I thought about using a multidimensional dynamic array and using Delphi help
could probably get this working. However, I'm new to Windows programming (1+
yrs) and want to learn OO. I've written a couple of objects recently, so
thought I might try to tackle this as a Q object which has multiple X
objects inside it, and then multiple F objects inside the X objects.

I've started reading about collections and trying some sample code, but
don't know enough to create a collection within a collection, or even if
that's a correct concept.

Any comments or suggestions? Would a TObjectList be better? Should I just
stick to an array?

TIA
Dave Jollie
Developer, TOWER NZ IT
(: 09 368 4259
J: 09 306 6801
*: [EMAIL PROTECTED]
.: 46 Parnell Rd, Parnell, Auckland
---
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 is the best way

2003-08-06 Thread Dennis Chuah

Jeremy,

OK then, is it even simpler.

 Design:  Use interfaces or an abstract base class.  Define the methods
 that do the data conversion in the interface / abstract base class.
 For each dat conversion method, create a concrete class that either
 implements the interface or sub-classes the abstract base class.

Then,

Create a factory method that reads an INI file and creates the appropriate
class for the device that you are trying to read.

Dennis.
- Original Message -
From: vss [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 9:26 AM
Subject: Re: [DUG]: What is the best way


 But Dennis, I might as well write a DLL for each type of device which as
 I have mentioned is NOT ideal and NOT practical. The same woudl apply to
 writting a package for each device.

 I think I will just uses classes and if there is a device not catered
 for, I will just have to release a new EXE.

 BUT I still have one or 2 other ideas to look at too as well tho.

 Jeremy

 -Original Message-
 From: Dennis Chuah [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Date: Wed, 6 Aug 2003 08:06:38 +1200
 Subject: Re: [DUG]:  What is the best way

  Message
  Design:  Use interfaces or an abstract base class.  Define the methods
  that
  do the data conversion in the interface / abstract base class.
  For each dat conversion method, create a concrete class that either
  implements the interface or sub-classes the abstract base class.
 
  Implementation:  Use packages.  Each class can be in its own package.
  Use
  an INI file setting to determine which package to load.  You can export
  a
  method in the package that creates an instance of the class and either
  returns the interface or the abstract base class reference.
 
  - Original Message -
  From: Jeremy Coulter
  To: Multiple recipients of list delphi
  Sent: Tuesday, August 05, 2003 10:54 PM
  Subject: [DUG]: What is the best way
 
 
  Hi All.
  I have got an app. that gets data from devices via the comport.
  60% if not more of the data from these devices is similar or easy  to
  deal
  with, like dates and times, but other info can be specific to a device,
  and
  i have to normalize it into a format that I want.
 
  In times gone by, about 6-7 years ago, if not more, when I first wrote
  this
  app., I used DLL's and depending onn teh devide you specified in an INI
  file
  it used that DLL, which I think from memory was done via the setup, so
  there
  was only one DLL.
  BUT this was really not a good idea, as it was hard to debug and just
  overall never practical.
 
  I have thought that I could use classes this time round, once again
  specifying the device type in an INI file, and then based onthat it
  would
  know hat class to use.
  But is this the best way either? I mean, if I find a device that has
  not got
  a class for it already, then its a new EXE release.
 
  I guess what woud be idea would be if I could load some specific
  functions
  up at runtime, and then access them then it would only ever be a txt
  file or
  whatever that I would need to distribute.
  I thought something like Delphi WebScript, but I need to get results
  back to
  go into a DB.
 
  Has anyone got any Ideas? Would Classes be the best? or is there
  something
  else I can look at?
 
  Cheers,
 
  Jeremy Coulter
 
 
  ---
  -
  All email scanned with Nortons Antivirus 2003
  ---
  -
  ---
  
  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]: What is the best way

2003-08-05 Thread Dennis Chuah
Message
Design:  Use interfaces or an abstract base class.  Define the methods that
do the data conversion in the interface / abstract base class.
For each dat conversion method, create a concrete class that either
implements the interface or sub-classes the abstract base class.

Implementation:  Use packages.  Each class can be in its own package.  Use
an INI file setting to determine which package to load.  You can export a
method in the package that creates an instance of the class and either
returns the interface or the abstract base class reference.

- Original Message -
From: Jeremy Coulter
To: Multiple recipients of list delphi
Sent: Tuesday, August 05, 2003 10:54 PM
Subject: [DUG]: What is the best way


Hi All.
I have got an app. that gets data from devices via the comport.
60% if not more of the data from these devices is similar or easy  to deal
with, like dates and times, but other info can be specific to a device, and
i have to normalize it into a format that I want.

In times gone by, about 6-7 years ago, if not more, when I first wrote this
app., I used DLL's and depending onn teh devide you specified in an INI file
it used that DLL, which I think from memory was done via the setup, so there
was only one DLL.
BUT this was really not a good idea, as it was hard to debug and just
overall never practical.

I have thought that I could use classes this time round, once again
specifying the device type in an INI file, and then based onthat it would
know hat class to use.
But is this the best way either? I mean, if I find a device that has not got
a class for it already, then its a new EXE release.

I guess what woud be idea would be if I could load some specific functions
up at runtime, and then access them then it would only ever be a txt file or
whatever that I would need to distribute.
I thought something like Delphi WebScript, but I need to get results back to
go into a DB.

Has anyone got any Ideas? Would Classes be the best? or is there something
else I can look at?

Cheers,

Jeremy Coulter



All email scanned with Nortons Antivirus 2003

---
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]: tregistry...

2003-07-23 Thread Dennis Chuah
I tend to avoid the registry like plague.  It is slow, has all sorts of 
permissions issues and is not suitable for storing larger amounts of data 
(you can run out of registry storage space).  Also I find too many programs 
stuff keys in the registry, bloating it up and making it unmanageable.  That 
is why there is so many registry clean-up programs out there.

I prefer to use Delphi class streaming (as used by Delphi to stream dfm 
files) to store data.  Keep your configuration info in a TPersistent class, 
and make sure all properties you want to store are in the published section. 
 I prefer to save as text (use ObjectBinaryToText and ObjectTextToBinary) 
because you can load the text file into a simple text editor and modify it - 
useful if you need to support clients.

Secure data can be encrypted - see TurboPower Lockbox in SourceForge for an 
open-sourced data encryption library.

Dennis.

From: Chris Veale [EMAIL PROTECTED]
Hi.
I just thought that if I am going to be having to process these regularly,
would it be better to store information in the system registry?  there is
going to be lots of data, but I know tregistry replaces the old 16 bit
tinifile.
would this be an option if I have about 5000 lines of variables I want to
retain?
plus the same number for approximately 20 other files I need to reference,
or is this complete overkill?
I have never played around with the registry before and Im not sure of the
load or proper procedure for doing something like this.
essentially the files I'm referencing are lookup files that, when the user
selects a certain combination of variables in the program, we graph the 
vars
read in from the file.

Hope that makes sence.

Chris

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.502 / Virus Database: 300 - Release Date: 18/07/03


__
The contents of this e-mail are privileged and/or confidential to the
named recipient and are not to be used by any other person and/or
organisation. If you have received this e-mail in error, please notify
the sender and delete all material pertaining to this e-mail.
__
---
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/
_
Surf the net and talk on the phone with Xtra Jetstream @  
http://www.xtra.co.nz/products/0,,5803,00.html !

---
   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]: Casting

2003-07-21 Thread Dennis Chuah

No, you cannot do it with a simple cast.

var
  Newfile:string;
  temp: TStringList;

begin
  temp := TStringList.Create;
  try
temp.Text := Newfile;
success := Burnfiles (temp);
  finally
temp.Free;
  end;


- Original Message -
From: Alistair George [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Monday, July 21, 2003 7:32 PM
Subject: [DUG]: Casting


 Hi all.
 Is there a way to cast a string to a single item stringlist eg
 function BurnFiles(Fileslist: tstringlist): boolean;

 var Newfile:string;

 if Burnfiles(Newfile ?? as Tstringlist.text) then success:=true;

 --
-
 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] Stream.ReadComponent, Stream.WriteComponent problem....

2003-07-10 Thread Dennis Chuah

May be asking the obvious but is the Boo property of TNamMessageForComms
published and not read-only?  Which version of Delphi are you using?  Also,
is TNamMessageForComms a TComponent?

- Original Message -
From: Donovan J. Edye [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 6:59 PM
Subject: [DUG]: [Q] Stream.ReadComponent, Stream.WriteComponent problem


 G'Day,

 See below for the class declarations and the encode and decode methods
that
 I am using. I am not compressing anything so this should be a plain write
 component to a stream and read it back again. However when I read the
 component again from the stream I can only see properties that are from
 TNamMessageForComms so for instance I can see Boo2, Payload, Header. But
all
 the properties for these subcomponents are not there. So for instance
 Payload.Boo is always an empty string. What am I missing here that is not
 making the sub components of TNamMessageForComms stream correctly.

 Any pointers etc. greatly appreciated.

 TIA


 function TNamMessageForCommsEncDec.Encode(const ACompression :
 TCompressionRange;
   const ASourceStream : TMemoryStream; var AOutputStream : TMemoryStream)
:
 TEncodeDecodeError;


 
 // PURPOSE: Encodes the supplied data into a stream for transmission. This
 // method is called by all the other overloaded methods of the same name.
It
 // makes use of the TNamMessageForComms
 // HISTORY:
 //   DJE 10/07/2003 #   Initial Creation
 begin
   //Default behaviour
   result := MSG_DECODE_ERR_UNKNOWN;
   AOutputStream.Clear;

   //Header
   FMessage.Header.MessageType := MSG_REGULAR;

   //Payload
   //Clear
   FMessage.Payload.Data_Clear;
   //Compression
   FMessage.Payload.Compressed := ACompression;
   //Assign
   FMessage.Payload.Data_Set(ASourceStream);

   //Now place on the output stream
   AOutputStream.WriteComponent(FMessage);

   //Show success
   result := MSG_DECODE_ERR_NONE;
 end;

 function TNamMessageForCommsEncDec.Decode(ASourceStream : TMemoryStream;
   var AOutputStream : TMemoryStream) : TEncodeDecodeError;


 
 // PURPOSE: Decodes a byte stream that was placed into the source stream
 // originally by Encode.
 // HISTORY:
 //   DJE 10/07/2003 #   Initial Creation
 begin
   //Default behaviour
   result := MSG_DECODE_ERR_UNKNOWN;
   AOutputStream.Clear;

   //First get the component in its entirey
   ASourceStream.Position := 0;
   FMessage := TNamMessageForComms(ASourceStream.ReadComponent(nil));

   //Decompress it if required
   //The class is optomised to deal with this assignment so there is no
 performance
   //penalty
   FMessage.Payload.Compressed := COMPRESSION_NONE;

   //Now return the payload ontothe stream supplied
   AOutputStream.Write(FMessage.Payload.Data,
SizeOf(FMessage.Payload.Data));

   //Show success
   result := MSG_DECODE_ERR_NONE;
 end;


 initialization
   RegisterClass(TNamMessageForComms);
   RegisterClass(TNamMessageForCommsHeader);
   RegisterClass(TNamMessageForCommsPayload);
 finalization
   UnRegisterClass(TNamMessageForComms);
   UnRegisterClass(TNamMessageForCommsHeader);
   UnRegisterClass(TNamMessageForCommsPayload);
 end.


   ENamMessageForCommsHeader = class(Exception);
   TNamMessageForCommsHeader = class(TComponent)



 //
 // This class contains all the META or header information for a
 particular
 // message. See TNamMessageForComms for more detail on why we are
using
 a
 // TComponent descendant. Keep this as small as possible as it will be
 prepended
 // to each message sent.
   private
 FMessageType : TMessageType;//Indicates the type of message
 property MessageType : TMessageType read FMessageType write
 FMessageType;
   published
   end;

   //Byte stream containing the data
   TPlayloadData = array of byte;

   ENamMessageForCommsPayload = class(Exception);
   TNamMessageForCommsPayload = class(TComponent)



 //
 // This class contains all the data payload for a message. See
 TNamMessageForComms
 // for more detail on why we are using a TComponent descendant
   private
 FBoo : string;
 FCompressed : TCompressionRange;
 FData : TPlayloadData;
 FZipper : TVCLZip;
 FZipTmpFileName : TFileName;
 procedure Set_Compressed(const Value : TCompressionRange);
 function Stream_Compress(ACompressionLevel : TCompressionRange; const
 AOriginalStream : TMemoryStream;
   var ACompressedStream : TMemoryStream) : boolean;
 function Stream_DeCompress(const AOriginalStream : TMemoryStream;
   var ADeCompressedStream : TMemoryStream) : boolean;
 function Stream_ToDataInternal(AStream : TMemoryStream) : boolean;
   

Re: [DUG]: Conversion

2003-06-28 Thread Dennis Chuah
popen is a function in Visual C's library.  Basically, it creates a pipe,
executes the process, cdrecord -atip, and redirect its output to the pipe.

Unfortunately Delphi does not have a popen in the VCL, but you can achieve
the same using a few lines of code that makes WinAPI calls.  The following
algorithm uses a temporary file instead of a pipe, but the result is the
same - you get the output of the spawned process.

1.  Call GetTempFileName to get the name of a temporary file

2.  Declare TSecurityAttributes like so:

var
  SecAtrrs: TSecurityAttributes;
begin
  SecAtrrs.nLength := SizeOf(SecAtrrs);
  SecAtrrs.lpSecurityDescriptor := nil;
  SecAtrrs.bInheritHandle := True;  // Must be set to True!!!

3.  Create the file using a call to CreateFile, passing in SecAtrrs.  It is
important to use SecAtrrs - otherwise it will not work.  Save the returned
handle in a variable.   See example:

var
  hOutput: THandle;
begin
  hOutput := CreateFile (PChar(TempFileFilename),
GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, @SecAtrrs, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL or FILE_ATTRIBUTE_TEMPORARY, 0);

4.  Declare TStartupInfo like so:

var
  StartupInfo: TStartupInfo;
begin
  FillChar (StartupInfo, Sizeof(StartupInfo), 0);
  StartupInfo.cb := SizeOf (StartupInfo);
  StartupInfo.wShowWindow := SW_HIDE; // Or you may choose to display it
  StartupInfo.dwFlags := STARTF_USESHOWWINDOW or
STARTF_FORCEOFFFEEDBACK or
STARTF_USESTDHANDLES;
  StartupInfo.hStdOutput := hOutput;  // Reassign stdout and stderr
  StartupInfo.hStdError := hOutput;

5.  Declare TProcessInformation like so:

var
  ProcessInformation: TProcessInformation;
begin
  FillChar (ProcessInformation, Sizeof(ProcessInformation), 0);
  FillChar (SecAtrrs, SizeOf(SecAtrrs), 0);

6.  Then call CreateProcess like so:

  CreateProcess (Nil, cdrecord -atip, Nil, Nil, True,
CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, Nil,
PChar(WorkingDir), StartupInfo, ProcessInformation);

where WorkingDir is the working directory for cdrecord.

7.  Retrieve the handles:

var
  ProcessHandle, ThreadHandle: THandle;
begin
  ProcessHandle := ProcessInformation.hProcess;
  ThreadHandle := ProcessInformation.hThread;

8.  Wait for it complete.

  if WaitForSingleObject (ProcessHandle, INFINITE) = WAIT_OBJECT_0 then

9.  Close the output file and other handles.  It is important to close the
process and thread handles because Windows will not do that automatically
for you.

  CloseHandle (hOutput); // To make sure all data is flushed to disk
  CloseHandle (ProcessHandle);
  CloseHandle (ThreadHandle);

10.  You can now read the contents of the temporary file (eg. open it using
a TFileStream), and delete it once you are done.

HTH,
Dennis.

- Original Message -
From: Alistair George [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 3:32 PM
Subject: [DUG]: Conversion


 Hi all.
 Can anyone translate this to pascal for me?

 FILE *fp
 fp=popen (cdrecord -atip, r)
 fread (fp) //gets the output

 --
-
 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]: I want to be subscriber of delphi.org.nz but without the messages flooding email

2003-06-28 Thread Dennis Chuah

I don't normally reply to non-technical messages like this to the list, but
I make an exception for this one because I think it might be of benefit to
others.  If you object, please delete this message.

Ben,

Why don't you simply set your mail filtering rules to move all messages to
your Deleted items or similar folder.  That way, your inbox will not be
cluttered.  Better still, create a NZDUG folder and redirect the mail
messages there.  This list is quite easy to filter because the subject
contains [DUG].

Regards,
Dennis.

- Original Message -
From: Ben none [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 3:07 PM
Subject: [DUG]: I want to be subscriber of delphi.org.nz but without the
messages flooding email


 Hi

 I want to be able to post messages to [EMAIL PROTECTED] and still read
 the
 message archive http://www.mail-archive.com/delphi%40delphi.org.nz/
 but I don't want to receive the messages through my email cos there is
just
 to much to read or delete.

 Is there anyway I can still be apart of the group without having my email
 chocka block.

 Please reply.

 Ben Iti

 _
 Check out the Xtra gaming servers at  http://xtramsn.co.nz/gaming !

 --
-
 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]: format function

2003-06-28 Thread Dennis Chuah

var
  A: array of TVarRec;

Just beware - it is not as simple as it seems.  For one, you will need to
make sure strings referred to by TVarRec remains active until after the call
to Format.

- Original Message -
From: Neven MacEwan [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 4:24 PM
Subject: [DUG]: format function


 Hi all

 I want to use the format function and pass it a dynamic array of values,
Can
 this be done

 S := 'Name is %s %s';
 Result := format(S,A)

 but how do I declare A?

 TIA

  Regards Neven
  N.K. MacEwan B.E. EE
  Ph 649 621 0001
  Fax 649 621 0400
  [EMAIL PROTECTED]

 --
-
 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]: Need component to imitate Windows Explorer

2003-06-26 Thread Dennis Chuah

Take a look at open sourced VirtualExplorerTree at
http://groups.yahoo.com/group/VirtualExplorerTree/.

or TurboPower Shell Shock (now open source) at
http://sourceforge.net/projects/tpshellshock/

- Original Message -
From: [EMAIL PROTECTED]
To: Multiple recipients of list delphi
Sent: Wednesday, June 25, 2003 3:07 PM
Subject: [DUG]: Need component to imitate Windows Explorer


I need a component which will allow me to imitate Windows Explorer, to allow
users access to a certain part of the file system. I need to be able to tie
it down security wise as much as I want e.g. stop deletes, stop copies, stop
renames, or allow all these things if appropriate. I've used an open dialog
which seemed by the properties provided, to suggest I could restrict these
things, but it didn't work. (With the particular scenario we have, it's not
possible to just use windows security, otherwise I'd do it that way).

Any suggestions? TIA
Dave Jollie
Developer, TOWER NZ IT
(: 09 368 4259
J: 09 306 6801
*: [EMAIL PROTECTED]
.: 46 Parnell Rd, Parnell, Auckland
---
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]: Those const again

2003-06-18 Thread Dennis Chuah

Delphi handles typed constants just like any variables.  The only difference
is typed constants can have an initial value, which you can then safely
change.  Don't worry about overwriting string memory because internally,
string variables are pointers to the string data.  So, changing the string
merely changes the pointer value.  String data is reference counted and the
string memory manager will know to free these data blocks when the reference
count drops to 0.

- Original Message -
From: Alistair George [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, June 19, 2003 8:57 AM
Subject: [DUG]: Those const again


 Hi all.
 Thanks for enlightening me on use of const.
 But.if a const is initialised like so:
 const FirstDir: string = '';
 Say another const is initialised eg NextConst then FirstDir:='I am now a
rather large
 string, whereas before i was length 0';
 There is no possibility of collision with NextConst is there? I would
 imagine not, but not knowing the way the assembler places it into memory
it
 could be a valid consideration.
 Thanks,
 Al+

 --
-
 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]: Interface Inheritance

2003-06-16 Thread Dennis Chuah

Let me simplify your example:

type
  TNewClass = class(TInterfacedObject,ISecondDescendant);

var
  First: IFirstDescendant;
  Second: ISecondDescendant;

Second := TNewClass.Create;  // Line 1
First := Second;  // Line 2

The above compiles and works fine.  Line 1 actually performs 2 operations:

1.  o := TNewClass.Create, where o is a temp var of type TNewClass
2.  Second := o

Contrary to popular belief, the second operation does not call
QueryInterface.  Instead, at compile time, the interface reference is bound
to the object reference.  This is because at compile time, the interface
reference is always a known offset from the object reference (see my last
long post).

To see this you can either look at the compiled code, or remove the GUID
from your interface declaration.  Without a GUID, the second operation still
works, whereas, if the second operation was:

Second := o as ISecondDescendent,

without a GUID will raise a compile time error.

Line 2 also works because ISecondDescendent implements all methods of
IFirstDescendents and are therefore assignment compatible.  The important
point here is they are assignment compatible, but they are different.

However, if you do:

First := Second as IFirstDescendent

you will get an exception EIntfCastError.  This is because the as operator
calls QueryInterface on Second, and TNewClass does not support
IFirstInterface.

Regards,
Dennis.

- Original Message -
From: Todd Martin [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 1:46 PM
Subject: Re: [DUG]: Interface Inheritance


 Hi Guys.

 Thanks for all the feedback. I didn't realise it would get so much
response.
 In the end I decided to go with the following :
 IFirstDescendant = interface(IInterface);
 ISecondDescendant = interface(IFirstDescendant);

 TNewClass = class(TInterfacedObject,IFirstDescendant ,ISecondDescendant);

 However I noticed one very peculiar aspect of interfaces along the way
when
 compiling.

 If I define a procedure
 DoSomething(AObject : IFirstDescendant);
 and
 TNewClass = class(TInterfacedObject,ISecondDescendant);

 and then the following code compiles okay

 procedure Test;
 var
 MyObject : ISecondDescendant;
 begin
   MyObject := TNewClass.Create;
   DoSomething(MyObject);
 end;

 I haven't checked yet, but I'm assuming the MyObject passed through to
 procedure DoSomething() is then nil, since TNewClass doesn't support
 IFirstDescendant. Would that be your guess too? So why does it compile? On
 the otherhand, does the ISecondDescendant pointer get sucessfully
converted
 to a IFirstDescendant pointer, in which case, why does
 MyObject.QueryInterface(IFirstDescendant,FirstObject) return a nil
pointer
 to FirstObject?

 However, if I define
 IFirstDescendant = interface(IInterface);
 ISecondDescendant = interface(IInterface);

 ie. no interface inheritance - (or whatever you want to call it)
 and

 TNewClass = class(TInterfacedObject,IFirstDescendant,ISecondDescendant);

 the Test() procedure does not compile. Any comments?

 Thanks.

 - Original Message -
 From: Conor Boyd [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Monday, June 16, 2003 10:31 AM
 Subject: RE: [DUG]: Interface Inheritance


  There are a lot of people (including me) who never use the term
'interface
  inheritance'.  You're right, it's not inheritance.
 
  As an aside, having had the 'chance' recently to go some VB6 coding
:-( I
  found the Microsoft documentation utterly misleading when it talks about
  interface inheritance, when IMO it should be talking about 'interface
  implementation', which is probably a phrase which is also appropriate to
  what we're talking about here.
 
  Cheers,
 
  Conor
 
  -Original Message-
  From: Karl Reynolds [mailto:[EMAIL PROTECTED]
 
   So this is one simple case where you have IStream inheriting
   from ISequentialStream (see ActiveX.pas) but you are not required
   to implement ISequentialStream is you are implementing IStream.
 
  Utterly bizarre.  I get your point - that interface inheritance has to
 be
  implemented the way it is in Delphi in order to support such
strangeness.
  But it's not really inheritance any more, is it.

 --
 -
  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]: Delphi optimizer

2003-06-16 Thread Dennis Chuah
One danger with hand optimising ASM code is illustrated by your example.  In
the generated code:

 mov byte ptr [eax+$304], $0

writes 0 to BYTE location [eax+$304], whereas you

mov [eax+$304], edx

writing a DWORD into location [eax+$304], possibly overwriting memory.

This sort of bugs can be vary hard to track down.  The software would seem
to work for some time, then a bug would appear in a complete unrelated area.

You should therefore write your code like:

xor edx, edx
mov [eax+$2fc], edx
mov [eax+$300], edx
mov byte ptr [eax+$304], $0

which is only a saving of one instruction!

On a Pentium CPU (and the AMD CPU's as well), basic instructions execute in
1 CPU clock cycle.  This means your hand optimised assembler only runs 1
nano second faster than that generated by Delphi.  I won't bother if I were
you.

Dennis.

- Original Message -
From: Leigh Wanstead [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, June 17, 2003 11:43 AM
Subject: [DUG]: Delphi optimizer


 Hello everyone,

 I was surprised that Delphi 7 generate following asmbler code for this
 pascal code. I have turned on Code generation/Optimization.

   fMyRecord.fLength := 0;
   fMyRecord.fCount := 0;
   fMyRecord.fReadOnly := False;

 xor edx, edx
 mov [eax+$2fc], edx

 xor edx, edx
 mov [eax+$300], edx

 mov byte ptr [eax+$304], $0

 I think the optimized asm code will look like this.

 xor edx, edx
 mov [eax+$2fc], edx
 mov [eax+$300], edx
 mov [eax+$304], edx

 I tested the hand written asm code, it is 5 cpu clock cycle faster. I hate
 to put asm in my source code. So the question is how to write delphi code
to
 generate optimize asm code like this one.

 I know this slow down may not sound that much, just for research purpose.

 I have enclosed delphi sample code for your reference. I look forward to
 hearing from you.

 TIA

 Best 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/


Re: [DUG]: Interface Inheritance (long)

2003-06-15 Thread Dennis Chuah
Simple answer is no.  Your class *DOES NOT* support IFirstDescendant.  You
must explicitly tell the compiler that your class supports IFirstDescendant:

TNewClass = class(TInterfacedObject,IFirstDescendant,ISecondDescendant)

Interface inheritance is *DIFFERENT* from class inheritance.  The idea of
interfaces is each interface is a complete and is independent of
implementation, whereas a class declaration can be incomplete (eg. abstract
base classes).  When you implement an interface, you must implement it
completely  (you can still make any non-implemented methods abstract).

Your example is a good one:

Though ISecondDescendant inherits from IFirstDescendant, it is a different
interface from IFirstDescendant and the only thing get from the inheritance
is the short form of not having to redeclare IFirstDescendant methods in
ISecondDescendant.

So why doesn't Delphi treat

TNewClass = class(TInterfacedObject,ISecondDescendant)

as

TNewClass = class(TInterfacedObject,IFirstDescendant,ISecondDescendant)?

The answer is because a class may implement its interfaces independently and
differently - eg.

IFirstDescendent = interface (IInterface)
  procedure A;
end;

ISecondDescendent = interface (IFirstDescendent)
  procedure X;
end;

TNewClass = class(TInterfacedObject,IFirstDescendant,ISecondDescendant)
  procedure A;
  procedure B;
  procedure X;

  procedure IFirstDescendant.A = A;
  procedure ISecondDescendant.A = B;
end;

TNewClass implements IFirstDescendent using procedure A, and
ISecondDescendant using procedures B and X.  ie.

p := TNewClass.Create;
a := p;
b := p;

a.A performs a different operation than b.A.

and even if you;

a := b;
a.A - actually calls TNewClass.B!


At compile time:

TInterfacedObject implements IInterface
TNewClass implements *ONLY* ISecondDescendant (its base class,
TInterfacedObject, implements IInterface).

Internally, Delphi creates a separate v-table for each interface a class
implements, but only one v-table for the class members.

So:

TObject == has one v-table

TInterfacedObject = class (TObject, IInterface) == has two v-tables:
  1.  v-table for TInterfacedObject, which is made up of the v-table for
TObject, plus any new or overriden method members of TInteracedObject.
  2.  v-table for IInterface

TNewClass = class (TInterfacedObject,ISecondDescendant) == has 3 v-tables:
  1.  v-table for TNewClass, which is made up of the v-table for TObject,
plus any new or overriden method members of TInteracedObject., plus new or
overriden method members of TNewClass.
  2.  v-table for IInterface
  3.  v-table for ISecondDescendant
There is no v-table created for IFirstDescendant.

However, the v-table for ISecondDescendant is made up of the v-table for
IInterface, plus all new methods from IFirstDescendant, plus all new methods
from ISecondDescendant.

Then at run time:

Each instance of the object you create will contain:
1.  A reference to the object's v-table
2.  The object's data members
3.  One reference to the v-table for each directly supported interface.

Using your example, an instance of TNewClass that is stored at location p
will look like:

p - reference to TNewClass's v-table
p+4 .. p+n+3 - TInterfacedObject data members (n - total number of bytes)
p+n+4 - reference to IInterface
p+n+8 .. p+n+m+7 - data members added by TNewClass (m - total number of
bytes)
p+n+m+8 - reference to ISecondDescendant

TNewClass.Create returns p
Casting p as IInterface returns p+n+4
Casting p as ISecondDescendant returns p+n+m+8

Optimation:

The compiler will optimise v-tables for interface declarations at compile
time so that linear sequences of inheritance without method overrides use
the same v-table.  Using your example, both IFirstDescendant and
ISecondDescendant will point to the same v-table.  If you declared TNewClass
as:

TNewClass = class(TInterfacedObject, IFirstDescendent,ISecondDescendant)

then your instance will look like

p - reference to TNewClass's v-table
p+4 .. p+n+3 - TInterfacedObject data members (n - total number of bytes)
p+n+4 - reference to IInterface
p+n+8 .. p+n+m+7 - data members added by TNewClass (m - total number of
bytes)
p+n+m+8 - reference to ISecondDescendant (also used for IFirstDescendent)

TNewClass.Create returns p
Casting p as IInterface returns p+n+4
Casting p as IFirstDescendent returns p+n+m+8
Casting p as ISecondDescendant returns p+n+m+8

If however, your interface declarations are non-linear:

IOtherDescendent = interface (IFirstDescendent)
TNewClass = class(TInterfacedObject,
IFirstDescendent,ISecondDescendant,IOtherDescendent)

then the instance will look like:

p - reference to TNewClass's v-table
p+4 .. p+n+3 - TInterfacedObject data members (n - total number of bytes)
p+n+4 - reference to IInterface
p+n+8 .. p+n+m+7 - data members added by TNewClass (m - total number of
bytes)
p+n+m+8 - reference to ISecondDescendant
p+n+m+12 - reference to IOtherDescendent

TNewClass.Create returns p
Casting p as IInterface returns p+n+4
Casting p 

Re: [DUG]: Non-global Constants in a function

2003-06-15 Thread Dennis Chuah

What you read only applies to const parameters.  I would continue to use
method level consts and not move them to the unit level.  In fact, I *never*
use unit level vars, except for the Delphi generated main form code.  Using
method level is safer than unit level vars.

Eg. in multi-threading apps, the method can contain synchronisation code to
serialise access to the variable.

You can implement singleton classes like this:

TSingleton = class
  function GetInstance: TSingleton;
end;


function TSingleton.GetInstance: TSingleton;
const
  FInstance: TSingleton = Nil;
begin
  if not Assigned (FInstance) then begin
// Put thread sync code here
FInstance := TSingleton.Create;
  end;

  Result := FInstance;
end;

Dennis.

- Original Message -
From: Alistair George [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Friday, June 13, 2003 3:49 PM
Subject: [DUG]: Non-global Constants in a function


 In the past I have used const in a proc or func to allow re-entering the
routine
 later  to use the same variable value. But reading the following help it
seems I
 am doing the wrong thing. Should I be using a global variable instead?

 QUOTE
 A  constant  (const)  parameter  is like a local constant or read-only
variable.
 Constant  parameters  are  similar  to  value  parameters, except that you
cant
 assign  a  value  to  a  constant  parameter  within  the body of a
procedure or
 function,  nor can you pass one as a var parameter to another routine.
(But when
 you  pass  an object reference as a constant parameter, you can still
modify the
 objects properties.)

 eg
 function Tmainform.ParseAddFiles(FName: string; Recurse: boolean): string;
 const PrevDIR: string = '
';
 begin
   result := '';
   if pos('*.*', fname)  0 then
   begin
 PrevDIR := extractfiledir(fname);  //This remains until redefined??
 result := Fname;
 exit;
   end;
   if extractfiledir(fname) = prevdir then //this file is already in *.* so
omit
   begin
 result := '';
 exit;
   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
 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]: Re: Setting Windows Scheme Colours from Delphi - how?

2003-06-09 Thread Dennis Chuah

Moretti,

Windows stores the colour information in the registry on a per user basis.
The user information registry key starts with HKEY_USERS.  Under HKEY_USERS,
there should be at least 3 sub keys, .DEFAULT and for each user in the
system, a pair of keys made up of the internal GUID userID of the user.  I
am assuming Win2K + here, but Win98 is similar.  For the process' user, this
information is also reflected in HKEY_CURRENT_USER.  To change the current
user's settings, go to the key HKEY_CURRENT_USER\Control Panel\Colors, and
modify any of the named values inside that key.  Eg. the WindowText value
specifies the default foreground colour.  Data is stored as a
space-separated value string.  The first value is the red component,
followed by green then blue.  Valid values are from 0 to 255.

Modifications to HKEY_USERS\.DEFAULT\Control Panel\Colors only affect new
users, or existing users who create a new profile for themselves on the
machine.

After changing the registry setting(s), you must send the WM_SETTINGCHANGE
message.  This informs all top level windows to refresh themselves.  If you
forget to send this message, it is possible for some windows to remain in
the old colour while others (especially new windows) display in the new
colours.

Regards,
Dennis.

- Original Message -
From: Moretti, Giovanni [EMAIL PROTECTED]
To: Dennis Chuah [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 10:44 AM
Subject: Setting Windows Scheme Colours from Delphi - how?


Hi Dennis

 Firstly, you need to ask yourself where it is desirable to alter the
 Windows default colours from your app.  The usual way, as you say,
 is via the control panel.  Users could be confused and irritated if
 your app changes those colours without their knowledge.
 ...  Unless of course, the purpose of the software is to allow users
 change those Windows settings.

 If you can convince me why you would want to add this feature
 to your software, I'll tell you the Windows API calls to make.

Yes, I know it's probably not a good idea in production software,
however this is part of my PhD research on the feasibility of generating
harmonious colour schemes, semi-automatically. Part of this is to make
the colour of windows agree with surrounding object including the
background, window borders ...

I'm not sure that changing the overall colour scheme is desirable, but
I'd like to be able to have tried it and then be able to state for the
record that users found it disturbing (or not), rather than just
assuming they will.

Reason enough ...

Thanks
Giovanni

Giovanni Moretti  |  Institute of Information Sciences and Technology
Senior Lecturer   |  Massey University, Palmerston North, New Zealand
Computer Science  |  Ph 64-6-3505799x2474 == Fax 64-6-3502259 == ZL2BOI

http://www-ist.massey.ac.nz/moretti  mailto:[EMAIL PROTECTED]
---
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]: Graphics problems

2003-03-20 Thread Dennis Chuah

A JPEG file usually uses a compression algorithm that is not losses,
meaning, when you reconstruct the bitmap from a JPEG file it is different
from the original bitmap from which the JPEG was created.  This is done so
as to achieve compression rates that are higher than  loss-less compression
algorithms.  The reconstructed image is only visually similar to the
original.  Because of this, is not possible for you to convert a JPEF to
bitmap and them back to a JPEG without any loss of quality.  The JPEG format
should be used as the final storage / transmission (eg. for web sites)
format.  If you intend to do any processing on the image, then a loss-less
format, such as LZW compressed tiff should be used instead.

Dennis.


- Original Message -
From: Alistair George [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 12:02 PM
Subject: [DUG]: Graphics problems


 Hi All.
 I have a JPEG image, which if I convert to bitmap, then back to JPEG
again, it
 is not the same. The problem occurs in the stretchdraw function.
 Can anyone advise how I can replicate exactly the JPEG original without
copying
 the JPEG original to another JPEG?

 What happens is most graphics programs can load the new image, but there
is a
 difference I cannot ascertain which stuffs up some other graphics
programs.
 Thanks,
 al+

 procedure TForm1.btnWriteClick(Sender: TObject);
 var Orig,Smaller:tjpegimage;
 buffer:tbitmap;
 smallFname:string;
 begin
   smallFname := copy(ImgData.Filename,1,length(ImgData.Filename)-4)
 +'_smaller.jpg';
   JpegOut.FileName := smallFName;
   if not JpegOut.Execute then
 exit;
   SmallFName := JPegOut.FileName;
   Buffer := tbitmap.Create;
   Orig := tjpegImage.Create;
   Smaller := tjpegimage.create;
   try
 Orig.LoadFromFile(ImgData.Filename);
 Orig.DIBNeeded;
 Buffer.PixelFormat := pf24bit;
 Buffer.Width := orig.Width div 2;
 Buffer.Height := orig.Height div 2;
 // Even if the width  height are the same the following does not
return a
 //copy of the original JPEG (disregard compression etc)
 Buffer.Canvas.stretchdraw(rect(0,0,Buffer.width,buffer.height),Orig);
 Smaller.PixelFormat:=orig.PixelFormat;
 Smaller.Assign(Buffer);

 --
-
 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]: PostMessage

2003-03-19 Thread Dennis Chuah

You passed!  Been working too much in python lately:

for f in range (0, 10):  #Python
for f := 0 to 9 do // Delphi

Dennis.

- Original Message -
From: Neven MacEwan [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 3:39 PM
Subject: Re: [DUG]: PostMessage


 Denis

 Thanks, that would prob work

 mind you shouldn't that be for f := 0 to Screen.FormCount-1 do
 our were you just testing me :-)

 Neven


 - Original Message -
 From: Dennis Chuah [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Wednesday, March 19, 2003 3:21 PM
 Subject: Re: [DUG]: PostMessage


 
  HWND_BROADCAST only works with SendMessage.
 
  Try this code instead:
 
  var
f: Integer;
  begin
for f := 0 to Screen.FormCount do
  Screen.Forms[f].Perform (WM_APPDATACHANGE, 0, 0);
 
  Dennis.
 
  - Original Message -
  From: Neven MacEwan [EMAIL PROTECTED]
  To: Multiple recipients of list delphi [EMAIL PROTECTED]
  Sent: Tuesday, March 18, 2003 10:28 PM
  Subject: [DUG]: PostMessage
 
 
   Hi all
  
   In my app I have a whole lot of forms which are embedded in a page
 control
   of the 'Main Form'
   If one one these forms wants to notify all other forms in the app of a
   change, what is the best way to do it?
  
   Iv'e tried
  
 PostMessage(HWND_BROADCAST, WM_APPDATACHANGE, 0, 0);
  
   but none of the other forms seem to get this message, is this because
I
   really only have 1 form in my app?
  
   TIA
  
  
Regards Neven
N.K. MacEwan B.E. EE
Ph 649 621 0001
Fax 649 621 0400
[EMAIL PROTECTED]
  
 

 --
  -
   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]: Free TWebBrowser component for use with D7 Personal?

2003-03-18 Thread Dennis Chuah

Throw away the TWebBrowser implementation that comes with Delphi and take a
look at this alternative:

http://www.euromind.com/iedelphi/

Dennis.

- Original Message -
From: Moretti, Giovanni [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 3:43 PM
Subject: [DUG]: Free TWebBrowser component for use with D7 Personal?


Hi

All the internet components are missing with D7 Personal. Anyone know of
an equivalent to the TwebBrowser component - looks like a memopad but is
actually a web browser window.

Just something simple - a component you can resize at design time with a
method that does a Load this URL into it would suffice ...

Thanks
Giovanni

Giovanni Moretti  |  Institute of Information Sciences and Technology
Senior Lecturer   |  Massey University, Palmerston North, New Zealand
Computer Science  |  Ph 64-6-3505799x2474 == Fax 64-6-3502259 == ZL2BOI

http://www-ist.massey.ac.nz/morettimailto:[EMAIL PROTECTED]
---
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]: PostMessage

2003-03-18 Thread Dennis Chuah

HWND_BROADCAST only works with SendMessage.

Try this code instead:

var
  f: Integer;
begin
  for f := 0 to Screen.FormCount do
Screen.Forms[f].Perform (WM_APPDATACHANGE, 0, 0);

Dennis.

- Original Message -
From: Neven MacEwan [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 10:28 PM
Subject: [DUG]: PostMessage


 Hi all

 In my app I have a whole lot of forms which are embedded in a page control
 of the 'Main Form'
 If one one these forms wants to notify all other forms in the app of a
 change, what is the best way to do it?

 Iv'e tried

   PostMessage(HWND_BROADCAST, WM_APPDATACHANGE, 0, 0);

 but none of the other forms seem to get this message, is this because I
 really only have 1 form in my app?

 TIA


  Regards Neven
  N.K. MacEwan B.E. EE
  Ph 649 621 0001
  Fax 649 621 0400
  [EMAIL PROTECTED]

 --
-
 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] A design issue...

2003-02-13 Thread Dennis Chuah

You will need a second thread to solve your problem.  In a nutshell:

1.  Display a modal dialogbox with a cancel button - this provides your
block.
2.  Run the lengthy process on a separate thread, but at regular intervals,
check that the thread is terminated, and if it is, exit out of the execute
method.
3.  The cancel button terminates the thread
4.  The thread closes the dialogbox just before it exists from the execute
method.
5.  Optionally, you can have the thread periodically update dialog, eg.
display progress.

HTH,
Dennis.

- Original Message -
From: Donovan J. Edye
To: Multiple recipients of list delphi
Sent: Friday, February 14, 2003 12:12 PM
Subject: [DUG]: [Q] A design issue...


G'Day,

I have been trying to come up with an elegant solution to something but have
not had any success. Some suggestions and comments would be most welcome.
This is the scenario:

1. Application is single threaded
2. Makes call to a procedure that is very intensive (say a recursive scan of
a directory tree)

Now I dont want the 2. call to return until it has completed what it is
doing. However as it utilises 100% CPU the main application suffers. So how
do I work around this?

Possible Solutions

a) Provide a callback in the 2. procedure so that the application can do
something about things. Say call Application.ProcessMessages

This is OK, but it would be nice if the caller of 2. did not have to do
anything.

So I guess my question is. How do I change 2 so that it:

- Co-Operates nicely with its caller in terms of resource usage
- Blocks until it finishes

Is it somehow possible to kick off a thread in 2. but still have it block
until it finishes what it has to do?

I hope this is clear. Any comments, suggestions welcome.


-- 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.
--
---
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] Library Units -- Run Time Package?

2003-02-12 Thread Dennis Chuah

I would create 3 packages, a runtime only package for the common units,
another runtime only package for the components and a design-time only
package for the property editor stuff.

- Original Message -
From: Donovan J. Edye
To: Multiple recipients of list delphi
Sent: Wednesday, February 12, 2003 3:19 PM
Subject: [DUG]: [Q] Library Units -- Run Time Package?


G'Day,

We have some common units for things like string handling etc. At present
these are just seperate units in the file system. We also have our own
components package which has runtime and design time flags set which uses
these units. The unfortunate side effect is that if someone creates a new
package that uses one of these common units then our main package is
required. So to avoid this I was considering placing all our common units
into a package that is a run-time package. Is this the best solution or is
there another way?


-- 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.
--
---
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] Library Units -- Run Time Package?

2003-02-12 Thread Dennis Chuah

If a package only has components and does not contain any property editors
or code to register the components, then you OUGHT TO make it runtime only,
but you DONT HAVE TO.  However, if a package refers to Delphi's design time
packages, then it MUST BE made a design-time only package.  Does this make
sense?

I have a general rule that all my component packages are runtime only and I
create design-time only packages for the property editors and registration
code.  The only exception to this rule is if I need to use an object
inspector type interface at runtime, eg. using Dream Controls. I do this so
that I do not have to redistribute code that is only used at design time but
not at run time.

Dennis.

- Original Message -
From: Donovan J. Edye
To: Multiple recipients of list delphi
Sent: Thursday, February 13, 2003 1:51 PM
Subject: Re: [DUG]: [Q] Library Units -- Run Time Package?


D,

If a component does not have any property editors is it just a runtime
package?

At 07:34 13/02/2003 +1300, you wrote:


I would create 3 packages, a runtime only package for the common units,
another runtime only package for the components and a design-time only
package for the property editor stuff.

- Original Message -
From: Donovan J. Edye
To: Multiple recipients of list delphi
Sent: Wednesday, February 12, 2003 3:19 PM
Subject: [DUG]: [Q] Library Units -- Run Time Package?


G'Day,

We have some common units for things like string handling etc. At present
these are just seperate units in the file system. We also have our own
components package which has runtime and design time flags set which uses
these units. The unfortunate side effect is that if someone creates a new
package that uses one of these common units then our main package is
required. So to avoid this I was considering placing all our common units
into a package that is a run-time package. Is this the best solution or is
there another way?


-- 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.
--
---
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/
-- 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.
--
---
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]: Ellipsis truncation

2003-01-21 Thread Dennis Chuah

Call the WinAPI function DrawText (or it might have been DrawTextEx), and
one of the options is to shorten the string with an ellipsis.  You can also
get DrawText to return the shortened string, rather than draw it on the
canvas.

Dennis.

- Original Message -
From: Nahum Wild [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, January 22, 2003 11:49 AM
Subject: RE: [DUG]: Ellipsis truncation


 We are currently still using Delphi 4 and don't seem to have it. :o(


 Nahum.

  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
  wrote on
 
  MinimiseName in FileCtrl unit...
 
  Why it's not in the D5 help, I dunno...
 
  HTH,
 
  C.
 
  -Original Message-
  From: Nahum Wild [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, 22 January 2003 11:32 a.m.
  To: Multiple recipients of list delphi
  Subject: [DUG]: Ellipsis truncation
 
 
  Does anybody know of a good way of shortening a capition shown on
  screen to X pixels and putting an '...' at the end?  I seem to recall
  that there might be an API call that'll do it, but I can't remember
  it's name.
 
 
  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
  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]: Repaint/Refresh/Invalidate ???

2003-01-15 Thread Dennis Chuah

DrawMenuBar (Form.Handle);

- Original Message - 
From: Paul Mckenzie 
To: Multiple recipients of list delphi 
Sent: Wednesday, January 15, 2003 1:30 PM
Subject: [DUG]: Repaint/Refresh/Invalidate ???


Does anyone know how to force a menu to repaint itself ?


Regards
Paul McKenzie
Analyst Programmer
SMSS 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
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



Re: [DUG]: TPagecontrol

2003-01-12 Thread Dennis Chuah

The font property of the tab is used as the default font for its child
controls if the ParentFont property is True.  To display each tab
differently, you will need to handle the page control's OnTabDraw event and
draw the tab yourself (set OwnerDraw := True first).

Dennis.

- Original Message -
From: Alistair George [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Sunday, January 12, 2003 7:18 PM
Subject: [DUG]: TPagecontrol


 Hi all.
 In tabsheet there is a font property. But how does one actually change the
font
 on the tab itself??
 AL+

 --
-
 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]: Adding Icons to the Menu bar....

2003-01-09 Thread Dennis Chuah

Why don't you use owner drawn menu items?  When you draw the last item, make
it large enough to accomodate the bitmaps, but draw the border so that the
menu looks like it stops at the last item.

- Original Message -
From: Paul Mckenzie
To: Multiple recipients of list delphi
Sent: Friday, January 10, 2003 2:29 PM
Subject: [DUG]: Adding Icons to the Menu bar


G'day

Does anyone know if icons can be added (preferably easily) to the menu bar -
but not as a menu item...
What i need to do is add 4 icons to the menu bar, just after the last menu
item.
I acn sort-of do this by adding blank menu items and setting a BMP for each
item.
The problem is that  they are still clickable or loook clickable even if
disabled - when the mouse goes over
the bevel edge appears to indicate they are menu items.

I could live with just turning off the bevel edge thing - but the menu is
inherited and it is only the last 4 items I want to turn it off for.

Any help, ideas, suggestions much appreciated.

Regards
Paul McKenzie
Analyst Programmer
SMSS 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
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



Re: [DUG]: Automating Internet Explorer from Delphi

2002-11-26 Thread Dennis Chuah

procedure SetData;
var
  doc: IHTMLdocument2;
  elem: IHTMLElement;
begin
doc := IE.document as IHTMLdocument2;
elem := doc.all.item('mycontrol',0) as IHTMLElement;
elem.value := 'SomeValue';
end;

In the HTML document:

form
  input type=text id=mycontrol


HTH
Dennis.


- Original Message -
From: [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, November 27, 2002 2:44 PM
Subject: [DUG]: Automating Internet Explorer from Delphi


 I want to use IE as an OLE Automation server. I've found the events,
methods
 and properties for the IE Object on MSDN. However, I'm having trouble
 finding what I need. I want to go to a particular URL (no problems) and
then
 enter a user name and password, which that page prompts for. Can I get
this
 level of interaction, where I can effectively fill in forms and click
 buttons in IE, on behalf of the user? If so, which events / methods /
 properties should I use and how?

 Anyone done this? Any sites recommended?

 Cheers

 Dave Jollie
 Software Developer BOA IT
 09 368 4259 ext 6231

 The information contained in this mail message is confidential and may
also
 be legally privileged. If you are not the intended recipient, please note
 that any use, dissemination, further distribution, or reproduction of this
 message in any form what so ever, is strictly prohibited.  If the mail is
in
 error, please notify me by return E-mail, delete your copy of the message,
 and accept my apologies for any inconvenience caused.

 --
-
 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 Dennis Chuah

It depends on the size of your loop.  If you are going to be appeding a
great number of strings, then I would suggest a string buffer approach -
where each iteration of the loop writes one string into the string buffer,
while an int variable is incremented with the length of the string.  Then
create a string with the length of the int.  In another loop, take the
strings from the buffer and write to the allocated string.

I have done tests with loops in sizes ranging from 10, 100, 1000, through to
1mil.  The time savings for the 1mil loop is several oders of magnitude.  I
won't bother for anything less than 100.

Dennis.

- Original Message -
From: Neven MacEwan
To: Multiple recipients of list delphi
Sent: Friday, November 01, 2002 12:27 AM
Subject: [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 = 0 then Result := Item(I)
else Result := format('%s%s%s',[Result,Sep,Item(I)])
end;

Variants and explainations pls

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
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



Re: [DUG]: Friday Challange

2002-10-31 Thread Dennis Chuah

I think you can safely assume that an SQL query will have less than 100 or
so joins, so no need for string buffers.  Perhaps the *REAL* Friday
challenge is to come with an SQL statement with  100 joins!

Dennis.

- Original Message -
From: Neven MacEwan [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Friday, November 01, 2002 10:03 AM
Subject: Re: [DUG]: Friday Challange


 Dennis

 Therein lies the challange, to come up with an efficient 'Join' procedure
 that
 require no preknowlege of iteration count or item length

 would the format be sominthing like

 TJoinItemFunction = function(Index: integer): string;
 TJoinOption = (joRemoveBlanks, joUnique, joCaseSensitive);
 TJoinOptions = set of TJoinOption;

 function Join(GetItem: TJoinItemFunction ; count: integer; const Sep:
 string, Options TJoinOptions): string;

 N


 - Original Message -
 From: Dennis Chuah [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Friday, November 01, 2002 9:36 AM
 Subject: Re: [DUG]: Friday Challange


 
  It depends on the size of your loop.  If you are going to be appeding a
  great number of strings, then I would suggest a string buffer approach -
  where each iteration of the loop writes one string into the string
buffer,
  while an int variable is incremented with the length of the string.
Then
  create a string with the length of the int.  In another loop, take the
  strings from the buffer and write to the allocated string.
 
  I have done tests with loops in sizes ranging from 10, 100, 1000,
through
 to
  1mil.  The time savings for the 1mil loop is several oders of magnitude.
 I
  won't bother for anything less than 100.
 
  Dennis.
 
  - Original Message -
  From: Neven MacEwan
  To: Multiple recipients of list delphi
  Sent: Friday, November 01, 2002 12:27 AM
  Subject: [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 = 0 then Result := Item(I)
  else Result := format('%s%s%s',[Result,Sep,Item(I)])
  end;
 
  Variants and explainations pls
 
  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
  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]: Polymorphic assignment to Color - How? (sometime it's a Property, sometimes not)

2002-10-23 Thread Dennis Chuah



This is a hack but...

type
 TInternalControl = class 
(TControl);
 TInternalGraphicsObject = class 
(TGraphicsObject);

procedure setObjectColour (obj: 
TObject;newColour: TColor);
begin
 if obj is TControl then
 TInternalControl 
(obj).Color := newColour
 else if obj is TGraphicsObject 
then
 TInternalGraphicsObject 
(obj).Color := newColour;
end;
The other ways are the interface / typinfo ways as 
suggested in previous emails.I would however, implement the 
interfaces using the adapter pattern instead of using inheritance:

type
 IColourable = interface
 // Interface GUID
 procedure SetColour 
(Value: TColor);
 function GetColour: 
TColor;
 property Colour: TColor 
read GetColour write SetColour;
 end;

 TColourableControlAdapter = class 
(TInterfacedObject, IColourable)
 private
 FControl: 
TControl;

 procedure SetColour 
(Value: TColor);
 function GetColour: 
TColor; 

 public
 constructor Create 
(AControl: TControl);
 end;

 TColourableGraphicsObject = class 
(TInterfacedObject, IColourable)
... similar to 
TColourableControlAdapter

constructor 
TColourableControlAdapter.Create(AControl: TControl);
begin
 inherited Create;
 FControl := AControl;
end;

procedure 
TColourableControlAdapter.SetColour (Value: TColor);
begin
 // using the hack 
above...
 TInternalControl (FControl).Color := 
Value;
end;

Then instead of a TList, you use 
TInterfaceList:

var
 list: IInterfaceList;

begin
 list := 
TInterfaceList.Create;

To add objects to the list:

list.Add (TColourableControlAdapter.Create 
(MyForm));

list.Add (TColourableGraphicsObject.Create 
(MyFont));

To set the colour:

 (list.Items[Index] as 
IColourable).Colour := newColour;

You don't need to free the list or any of the 
interfaces in the list because as the list goes out of scope it will 
automatically be freed via reference counting.

Dennis.

- Original Message - 
From: "Moretti, Giovanni" [EMAIL PROTECTED]
To: "Multiple recipients of list delphi" 
[EMAIL PROTECTED]
Sent: Wednesday, October 23, 2002 6:23 
PM
Subject: [DUG]: Polymorphic assignment to Color - 
How? (sometime it's a Property, sometimes not)
 Hi  I'm building a list of objects that can be 
coloured and want to be able to get/set their colour.  The 
object properties are all going to be stored in a Tlist so the types will 
probably need to be stored along with them. I'm happy to store the Object type 
(eg Tform ...) along with the reference to the object but I can't see a general 
way to do this and get/set the color.  = ATTEMPT #1 
===  In the olden 
days, before properties, I'd have just passed a pointer to the Tcolor 
value:   procedure setObjectColour 
(Color : ^TColor ;  
 
newColour : TColor);  begin 
 Color^ := newColour; 
 end;   
setObjectColour(@Label3.Color, clRed);  I tried this, but it's 
unpredictable as sometimes an object's color is just a TColor (a glorified 
integer) but other times it's a property with get/set methods.  
= ATTEMPT #2 === 
 Figuring the run-time type information should be able to handle this, I 
tried:   Type TControlClass = Class of 
Tcontrol;   procedure setObjectColour ( 
obj : TObject;  
 
whatClass : TControlClass; 
 
newColour : TColor);  begin  (obj as 
whatClass).color := newColour; 
 
^-- ERROR - COLOR not declared  // OR  
 whatClass(object).color := newColour; 
 
 
^Missing Operator or ;   end; 
  setObjectColour(Label3, Tlabel, clRed); // To Recolour 
something   But neither will compile without 
errors.  = FINALLY 
===  It's not elegant 
but has the great virtue that it actually works:   
procedure setObjectColour ( obj : TObject; 
 
 
newColour : TColor);  begin  
if (obj is TForm) then (obj as TForm) .color 
:= newColour  else if (obj is TLabel) then (obj as 
TLabel).color := newColour  else if (obj is TFont ) 
then (obj as TFont) .color := newColour  else if (obj 
is TBrush) then (obj as TBrush).color := newColour  
else if (obj is TPen) then (obj as TPen) .color := 
newColour  else showMessage('setObjectColour: Don''t 
know how');  end;   setObjectColour(Form1, 
clRed);  Except this means that adding new types of things will 
require adding of extra "if .." statements which with polymorphism should be 
necessary. Unfortunately you can't do the more general:  
 (obj as Tcontrol).color := newColour;  As 
Tcontrol's "color" is protected (and can't be seen this won't compile). Only 
Tcontrol's descendents expose some way of getting/setting color. 
 I want to be able to recolour anything that has a colour but there must 
be a better way than tests for explicit types/classes ...  Any 
Ideas?  Thanks Giovanni 
 
Giovanni Moretti | Institute of Information Sciences and 
Technology Senior Lecturer | Massey University, 
Palmerston North, New Zealand Computer Science | Ph 

Re: [DUG]: Polymorphic assignment to Color - How? (sometime it's a Property, sometimes not)

2002-10-23 Thread Dennis Chuah

 You said the first bit is a hack. Well I don't see that you
 used any blunt instruments in getting access to protected properties.
 Just a little cheating.

It is a hack because it assumes that a base class can be safely cast into a
descendent.  This is OK due to the nature of Delphi's code generation, but
code like this will not work on say the .NET framework.

   B/ you failed to mention that in this case you would then also have to
 create adaptors for every other case available which wasn't a
 control.

In my post, there was...

  TColourableGraphicsObject = class (TInterfacedObject, IColourable)
  ... similar to TColourableControlAdapter

   C/ when creating the adaptors in the first place to put in the list,
 you would then also have to have a big if statement testing which class
 you are creating an adaptor for.

No you don't - because you know the type of the objects at the time when you
add the objects to the list, you simply choose the appropriate
implementation, i.e., instead of writing

var
  tl: Tlist;
  MyFont: TFont;
  MyForm: TForm;

begin
  tl.Add (MyFont);
  tl.Add (MyForm);

you write:

var
  list: IInterfaceList;
  MyFont: TFont;
  MyForm: TForm;

begin
  list.Add (TColourableFontAdapter.Create (MyFont));
  list.Add (TColourableControlAdapter.Create (MyForm));

I don't see the need of if's, etc.

The very idea of using adapters is to avoid the use If's to test the class
type.  The adapters abstract out the different interfaces for the color
property into one common interface.

 The question was a simple one. Given an object of unknown class, how do
 you change the color property?

I think you also need to read the original post *CAREFULLY*.  I belief the
question was:

 Polymorphic assignment to Color - How? (sometime it's a Property,
sometimes not)

 I'm building a list of objects that can be coloured and want to be able to
get/set their colour.

 The object properties are all going to be stored in a Tlist so the types
will probably need to be stored along with them. I'm happy to store the
Object type (eg Tform ...) along with the reference to the object but I
can't see a general way to do this and get/set the color.

As far as I can see all the different proposed solutions satisfy the
problem:  I can't see a general way to do this and get/set the color..  I
don't think any one of them is right / wrong, good / bad.  They are
different approaches to solving one problem and have different pros and
cons.  The interface / adapter solution abstracts out the color property
into a common interface (polymorphic behaviour), is extensible but at the
expense of more code. The typinfo method uses RTTI and less code but assumes
that all object has a published property named Color, is slower and is not
extensible.

Hopefully, Giovanni will have plenty to think about and choose the solution
appropriate to his problem.

This kinda reminds me of a German joke, Our solution is your problem - a
broken English version of We have the solution to your problems.

Dennis.

- Original Message -
From: Kyley Harris [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, October 24, 2002 10:36 AM
Subject: RE: [DUG]: Polymorphic assignment to Color - How? (sometime it's a
Property, sometimes not)


 Now that I've woken up (yawn)

 I have to reply to two posts in one.

 1/ Neven. Your solution is a good one. I do agree. I disagree that it
 was a good answer only :) based on the question asked. From the samples
 given etc of source, I would think that your solution did not solve the
 question appropriately based on the coding style and requirements of the
 query.

 2/ Dennis. You said the first bit is a hack. Well I don't see that you
 used any blunt instruments in getting access to protected properties.
 Just a little cheating. The control adaptor is also a good solution to a
 problem. But in this case it also is not a good answer because:
   A/ who said anything about it coming from Tcontrol? Only that it would
 have a color property.
   B/ you failed to mention that in this case you would then also have to
 create adaptors for every other case available which wasn't a
 control.
   C/ when creating the adaptors in the first place to put in the list,
 you would then also have to have a big if statement testing which class
 you are creating an adaptor for. (no better than the original if
 statement), or you would need a dymamic generation of classes against
 class adaptors, Which would need to be implemented somewhere.

 The question was a simple one. Given an object of unknown class, how do
 you change the color property?

 While interfaces are cool, and adapters are neat. None of them actually
 answered the question within the standard potential of a delphi object.

 Hopefully they give everyone who didn't know of these options more
 insight. As I say, cats can be skinned nine times, then you get another
 cat :)

 -Original Message-
 From: [EMAIL 

Re: Re[2]: [DUG]: Treelist with checkbox

2002-10-22 Thread Dennis Chuah

Alistair,

Hi.  You can download theme manager from the same place as you download
virtual tree view.  All I do is to put both of them in the same directory,
build and register the tree's design time package.  You will need to add the
dir to your project's search path.  The tree view requires the theme manager
because it is theme aware but will turn off all theme functions when not
running under XP.

I would fully recommend the virtual tree view, having used it and found that
it is very fast and reliable, with very few bugs.  There are lots of
properties and events to allow customisation to a wide degree.  Full source
is available - it makes it really easy to identify problems and to add new
features.

If you go to http://www.delphi-gems.com/VirtualTreeview/VTGallery.php, you
can download a file manager type app built using the tree - which includes
source code.  There is also another project that displays the structure and
contents of an XML document.  This project also uses the tree to display a
directory list.  Unfortunately, to download this you will need to join the
German discussion list in Yahoo.  I used the translator at altavista.com to
help me navigate through the German web site.

In anycase, I would suggest you download the advanced demo.  This displays
most of what you can do with the tree and there is certainly a page that
shows the directory / file structure with checkboxes.

HTH,
Dennis.

- Original Message -
From: Alistair George [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, October 22, 2002 3:58 PM
Subject: Re[2]: [DUG]: Treelist with checkbox


 Hello Dennis,
 Thanks for info - I had played around with VirtualTree before but compiler
asks for
 ThemeManager5 which I do not have nor can find on the delphi disk.

 I really wanted to know how to propagate a treeview with a directory list.
 Cheers,
 Al+



 Tuesday, October 22, 2002, 3:11:58 PM, you wrote:

 DC Virtual Tree from Mike Lischke
 DC (http://www.delphi-gems.com/VirtualTreeview/VT.php) has built in
support for
 DC checkboxes.  I think there is a derivative that shows the contents of
 DC directories as well - take a look at
 DC http://www.delphi-gems.com/VirtualTreeview/VTGallery.php.

 DC Dennis.

 DC - Original Message -
 DC From: Alistair George [EMAIL PROTECTED]
 DC To: Multiple recipients of list delphi [EMAIL PROTECTED]
 DC Sent: Tuesday, October 22, 2002 2:58 PM
 DC Subject: [DUG]: Treelist with checkbox


  Hi all.
  I have treelists galore and have searched, but cannot find, how to
 DC propagate
  them with for example directories and check boxes.
  Anyone point me to the resource for this info please?
  Thanks,
  Alistair+
 

 -
-
 DC -
  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/
 

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


 --
 Regards,
  Alistair+

 --
-
 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]: COM Object error

2002-10-22 Thread Dennis Chuah

From memory, VB only supports apartment threading model.  Depending on the
type of load your server is going to experience, you could try:  Have a
worker thread that communicated with the VB COM object.  The client
connection threads will need to place the data somewhere, then wait for the
worker thread to send the data away.

Anyway, apartment threading doesn't really support heavy loads.

Dennis.

- Original Message -
From: Phil Middlemiss [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, October 22, 2002 5:00 PM
Subject: [DUG]: COM Object error


 Hi all,

 I have an app that uses the Indy components to act as a TCP server. When
it
 get's a connection and receives the required data, the application uses a
 third party COM object to communicate the data to second server running on
a
 remote location.

 If I run a test routine and just send some dummy data to the second server
 then everything is fine. If I try exactly the same test code but this time
 call it when I have received some data from a connection to my TCP server,
 then I get an access violation from 'MSVBVM60.DLL' (the COM object was
 written in VB).

 I'm guessing its a threading issue since the TCP server is hanging on to a
 TIDPeerThread from it's Execute event. I've tried placing
 EnterCriticalSection etc around the code but it makes no difference.

 Does anyone have any ideas?

 Regards,
 Phil.


 --
-
 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]: Treelist with checkbox

2002-10-21 Thread Dennis Chuah

Virtual Tree from Mike Lischke
(http://www.delphi-gems.com/VirtualTreeview/VT.php) has built in support for
checkboxes.  I think there is a derivative that shows the contents of
directories as well - take a look at
http://www.delphi-gems.com/VirtualTreeview/VTGallery.php.

Dennis.

- Original Message -
From: Alistair George [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Tuesday, October 22, 2002 2:58 PM
Subject: [DUG]: Treelist with checkbox


 Hi all.
 I have treelists galore and have searched, but cannot find, how to
propagate
 them with for example directories and check boxes.
 Anyone point me to the resource for this info please?
 Thanks,
 Alistair+

 --
-
 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]: polymorphism problem

2002-10-17 Thread Dennis Chuah

I stepped through your code and it *DEFINITELY* calls TMetadata.Create.
What you have done looks correct and this is certainly not a polymorphism
pproblem.  Few suggestions:

1.  Check that you do not have $(DELPHI)\Lib in your project path - it
should only be in the global library path.
2.  What if you replaced your code with:
  NGraphic := TMetadata.Create;

Step through the code - does it call TMetadata.Create?

3.  Check the class type of NGraphic and compare Pointer(NGraphic.ClassType)
against Pointer(TMetadata).  Are they the same pointer values?

What version of Delphi are you using?

Dennis.

- Original Message -
From: Jianming Lin (ASL)
To: Multiple recipients of list delphi
Sent: Thursday, October 17, 2002 4:35 PM
Subject: [DUG]: polymorphism problem




G'Day, guys,

procedure TryMetadata(ImgType : Integer);
var NGraphic: TGraphic;
GraphicClass: TGraphicClass;
begin
  ImgType := 1;
  case ImgType of
1 :  GraphicClass := TMetaFile;
2 :  GraphicClass := TBitmap;
  end;
  NGraphic := GraphicClass.Create;
end;


Why constructor  of TMetafile.Create is not called instead only
TObject.Create is called?





[Jianming Lin (ASL)]





This e-mail message has been scanned for Viruses and Content and cleared by
MailMarshal - For more information please visit www.marshalsoftware.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/



Re: [DUG]: polymorphism problem

2002-10-17 Thread Dennis Chuah
The is operator calls a class method to check that the object's class is
either the same as the compared to class or one of its children.  Using the
class type is the only way to test if an object is the same *BUT NOT* one of
its children.

Dennis.

- Original Message -
From: Andreas Toth [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Friday, October 18, 2002 9:17 AM
Subject: RE: [DUG]: polymorphism problem


 Have I missed something, or, is the third point suggesting a rather odd
 technique of testing if an instance is of a specific class when the
 is-operator would have done a much tidier job?


 -Andreas

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:owner-delphi;delphi.org.nz]On
 Behalf Of Dennis Chuah
 Sent: Friday, 18 October 2002 07:14
 To: Multiple recipients of list delphi
 Subject: Re: [DUG]: polymorphism problem



 I stepped through your code and it *DEFINITELY* calls TMetadata.Create.
 What you have done looks correct and this is certainly not a polymorphism
 pproblem.  Few suggestions:

 1.  Check that you do not have $(DELPHI)\Lib in your project path - it
 should only be in the global library path.
 2.  What if you replaced your code with:
   NGraphic := TMetadata.Create;

 Step through the code - does it call TMetadata.Create?

 3.  Check the class type of NGraphic and compare
Pointer(NGraphic.ClassType)
 against Pointer(TMetadata).  Are they the same pointer values?

 What version of Delphi are you using?

 Dennis.

 - Original Message -
 From: Jianming Lin (ASL)
 To: Multiple recipients of list delphi
 Sent: Thursday, October 17, 2002 4:35 PM
 Subject: [DUG]: polymorphism problem




 G'Day, guys,

 procedure TryMetadata(ImgType : Integer);
 var NGraphic: TGraphic;
 GraphicClass: TGraphicClass;
 begin
   ImgType := 1;
   case ImgType of
 1 :  GraphicClass := TMetaFile;
 2 :  GraphicClass := TBitmap;
   end;
   NGraphic := GraphicClass.Create;
 end;


 Why constructor  of TMetafile.Create is not called instead only
 TObject.Create is called?





 [Jianming Lin (ASL)]





 This e-mail message has been scanned for Viruses and Content and cleared
by
 MailMarshal - For more information please visit www.marshalsoftware.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/

---
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]: polymorphism problem

2002-10-17 Thread Dennis Chuah

I stepped through your code in D6 (don't have D5 installed on this
machine) - but perhaps there is something wrong in D5?  I am wondering in D5
whether TGraphic's constructor is protected?

Dennis.

- Original Message -
From: Jianming Lin (ASL) [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Friday, October 18, 2002 9:10 AM
Subject: RE: [DUG]: polymorphism problem




 -Original Message-
 From: Dennis Chuah [mailto:dennis_cs_chuah;hotmail.com]
 Sent: Friday, 18 October 2002 7:14 a.m.
 To: Multiple recipients of list delphi
 Subject: Re: [DUG]: polymorphism problem



 I stepped through your code and it *DEFINITELY* calls TMetadata.Create.
 What you have done looks correct and this is certainly not a polymorphism
 pproblem.  Few suggestions:

 1.  Check that you do not have $(DELPHI)\Lib in your project path - it
 should only be in the global library path.

 Checked

 2.  What if you replaced your code with:
   NGraphic := TMetadata.Create;

 Step through the code - does it call TMetadata.Create?

 Yes it does

 3.  Check the class type of NGraphic and compare
Pointer(NGraphic.ClassType)
 against Pointer(TMetadata).  Are they the same pointer values?

 Checked. still not get called.

 What version of Delphi are you using?

 D5 Ent


 Dennis.

 - Original Message -
 From: Jianming Lin (ASL)
 To: Multiple recipients of list delphi
 Sent: Thursday, October 17, 2002 4:35 PM
 Subject: [DUG]: polymorphism problem




 G'Day, guys,

 procedure TryMetadata(ImgType : Integer);
 var NGraphic: TGraphic;
 GraphicClass: TGraphicClass;
 begin
   ImgType := 1;
   case ImgType of
 1 :  GraphicClass := TMetaFile;
 2 :  GraphicClass := TBitmap;
   end;
   NGraphic := GraphicClass.Create;
 end;


 Why constructor  of TMetafile.Create is not called instead only
 TObject.Create is called?





 [Jianming Lin (ASL)]





 This e-mail message has been scanned for Viruses and Content and cleared
by
 MailMarshal - For more information please visit www.marshalsoftware.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/



#
 This e-mail message has been scanned for Viruses and Content and cleared
 by MailMarshal
 For more information please visit www.marshalsoftware.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]: Strange RECORD behaviour

2002-10-17 Thread Dennis Chuah
I guess you are using VB3 or a 16-bit version of VB.  If that is the case,
then the variable sizes are:

boolean - 2 bytes (-1 = true, 0 = false)
integer - 2 bytes
string * n - fixed length strings of n bytes

total = 45 bytes

In BP7:

Boolean - not quite sure about the size in BP7, but in D1 I think it is 1
byte (0 - false, 1 = true)
Integer - 2 bytes
sring[n] - 1 byte for string length, plus fixes n-bytes for string data

total = 46 bytes.

Use array of Char instead of string and you might need to use integer
instead of boolean.

HTH,
Dennis.

- Original Message -
From: [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Friday, October 18, 2002 10:08 AM
Subject: [DUG]: Strange RECORD behaviour


 I have been playing around with writing a random file in VisualBasic which
 works OK, then thought I would use BP 7 to access this random file and so
 created a record which I thought would be identical.

 I was getting garbage with the Pascal program so...

 When I look at the size of each, the BASIC version is 45 bytes and the
 Pascal Version is 46 !!??

 VB ... size is 45
 Type People
   InUse as Boolean
   RecPos as Integer
   Tag as Integer
   Total as Integer
   ID as Integer
   FirstName as String * 15
   LastName as String * 20
 end Type

 Pascal  ... size is 46
 Person = Record
   InUse: Boolean;
   RecPos : Integer;
   Tag   : Integer;
   Total : Integer;
   ID : Integer;
   FirstName : String[15];
   LastName : String[20];
 end;

 where is the problem? What is the solution?


 Laurie..



 --
-
 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]: Toolbutton tbsCheck not working

2002-10-16 Thread Dennis Chuah


You probably need a newer version of Comctl32.dll for the Win98 machine.

Dennis.

- Original Message -
From: Ross Levis [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, October 16, 2002 3:16 PM
Subject: [DUG]: Toolbutton tbsCheck not working


 D5 Pro/Win98.  Clicking a toolbutton with tbsCheck is not toggling the
 Down property.  In fact, the button is acting as if it is a standard
 tbsButton.  I tried it on WinXP and it works.  Is there anyway around it?

 Cheers,
 Ross.



 --
-
 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]: Resume Next in Delphi

2002-10-14 Thread Dennis Chuah


There is no direct resume next support in Delphi, but Delphi does support
goto's.  Having said that, in my many years of programming in Delphi and
before that in Turbo Pascal, I have never had to use the goto statement.

VB does not support structured exception handling (SEH), so you end up
having to write code that looks like this:

On Error GoTo SomeLabel
  DoSomething1
  If CheckForError1 then DoHandleError1
  DoSomething2
  If CheckForError2 then DoHandleError2

  GoTo EndLabel

SomeLabel:
  SomeErrorHandlingCode
  Resume Next

EndLabel:


In Delphi, you ought to use SEH:

try
  DoSomething1;
  DoSomething2;

except
  HandleError;
end;

or if you need to be more specific about which errors to handle:

try
  DoSomething1;
  DoSomething2;

except
  on Exception1 do HandleError1;
  on Exception2 do HandleError1;
end;

The SEH code tends to be easier to read - all code logic is presented in one
block and all error logic in another.  SEH is also more reliable.  Any
unhandled errors propagate to the higher level and get handled there,
whereas with VB the On Error statement only applies for the sub or function.
If you forget one, you immediately get a run time error.

SEH also has many other uses - far too many to list in an email.

Hope this helps.
Dennis.

- Original Message -
From: Traci Sumpter [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Monday, October 14, 2002 10:59 AM
Subject: [DUG]: Resume Next in Delphi



 Newbee at Delphi, Have done VB before and is wondering if Delphi has the
 same sort of function as resume next or resume LABEL:

 I know the try except and try finally, but am wondering how to continue or
 retry in Delphi... Hope my question is clear


 --
-
 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]: Cannot focus a disabled or invisible window

2002-10-14 Thread Dennis Chuah


tblCompany.Edit;
tblCompany.FieldByName('name').Value := txtNewValue.Text;
tblCompany.Post;
txtNewValue.Text := '';
txtHoneyPot.SetFocus;
btnSaveEdit.Visible := false;
txtNewValue.Visible := false;

The line that is causing you grief is btnSaveEdit.Visible := false;.  When
the user clicks on the button, the focus shifts to the button and making it
invisible when it receives the focus will cause the problem.  Note: the
button only gets the focus AFTER the OnClick event is fired.

When it comes to UI design I am not a big fan of making things appear and
disappear based on a program state, but if you must hide your button, I
would suggest using actions.  In the OnUpdate event of the action determine
whether to hide the button - check first to see if the button has focus.  if
it has, set the focus to the next control, then hide the button (by setting
the action's Visible property to False).

- Original Message -
From: Tracey Maule
To: Multiple recipients of list delphi
Sent: Tuesday, October 15, 2002 9:39 AM
Subject: [DUG]: Cannot focus a disabled or invisible window


Hi there...

I have a form with a DBGrid showing values from one table (tblCompany)
I am currently trying to provide new record/edit functionality with code,
rather than use one of those ugly DBNavigators.

My problem is with the edit.  I have an edit button displayed always, when
the user selects edit, an invisible edit box is made visible, along with a
save changes button.
(someone told me once not to allow users to edit/add within a grid...)
my problem is that when i click save changes i receive two error messages
(the original focus message (subject line) plus a dataset not in edit mode
one)

i suspect the focus problem is because i am making the edit box invisible
while focus is still set to it, however i tried setting focus to another
edit box and the error did not change.

heres the few lines of code i have
tblCompany.Edit;
tblCompany.FieldByName('name').Value := txtNewValue.Text;
tblCompany.Post;
txtNewValue.Text := '';
txtHoneyPot.SetFocus;
btnSaveEdit.Visible := false;
txtNewValue.Visible := false;

please lend me the benifit of your decades of experience and knowledge here

Tracey
Software Developer / Web Master
Logis
[EMAIL PROTECTED]
(025) 213-1065
---
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]: 64 bit ints

2002-08-18 Thread Dennis Chuah


Because IntToStr(Value: Integer) is faster (and smaller) than
IntToStr(Value: Int64) - Delphi (apart from Delphi.NET) generates code for
32-bit processors, and thus any 64-bit code will require more CPU cycles.
The linker is also able to optimise out the functions that are not
referenced, thus if IntToStr(Value: Int64) is not referenced, there is no
need for the function to live in the EXE.

Furthermore, by declaring two overloaded functions, code completion shows
both implementations - which more clearly identifies the purpose of
IntToStr.  Showing IntToStr as taking an Int64 parameter only can
potentially be confusing to someone who is new to Delphi.

Dennis.

- Original Message -
From: Trevor Jones [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Monday, August 19, 2002 12:29 PM
Subject: Re: [DUG]: 64 bit ints


 Steve:
   surely if you have just the one function

   function IntToStr(Value: Int64): string;

 and it's not overloaded, then the compiler still won't complain.

 That's why I was wondering what I had missed

 Trevor

 - Original Message -
 From: Steve Peacocke [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Saturday, August 17, 2002 4:58 PM
 Subject: Re: [DUG]: 64 bit ints


  No, you are missing nothing. One converts and Int64, the other an
Integer.
 
  Stops the compiler complaining that you are using the wrong variable
type.
 
  Steve
 
  At 04:26 pm 17/08/02, you wrote:
  I use quite a lot of these in my code, and from time to time need to
 convert
  them to striings, so I use IntToStr in SysUtils.
  
  I've noticed that there are two versions (overloaded) in sysUtils:
  
  { IntToStr converts the given value to its decimal string
 representation. }
  
  function IntToStr(Value: Integer): string; overload;
  function IntToStr(Value: Int64): string; overload;
  
  
  and their implementation is
  
  function IntToStr(Value: Integer): string;
  begin
 FmtStr(Result, '%d', [Value]);
  end;
  
  function IntToStr(Value: Int64): string;
  begin
 FmtStr(Result, '%d', [Value]);
  end;
  
  Am I missing something here?, they seem to be identical.
  
  Confused Trevor
  
  
  
 

---
   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]: [Q] Simple Streams Question in IDE

2002-08-08 Thread Dennis Chuah


If you are using D6, then it is a known debugger bug.  If you watched any
Int64 variable, you always end up with 0.

Dennis.

- Original Message -
From: Donovan J. Edye [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, August 08, 2002 3:18 PM
Subject: [DUG]: [Q] Simple Streams Question in IDE


 G'Day,

 If I code the TMemoryStream example from the help SaveToStream,
 LoadFromStream example and then step through the code why do my watches
 for TempStream.Position and TempStream.Size always show 0? (However the
 example does work)

 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.
 --

---
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]: Interfaces (and classes that support them)

2002-08-08 Thread Dennis Chuah


Factory methods is the way to go.  Personally, I prefer to use factory
classes (actually factory interfaces).  You certainly don't want to limit
your design to inherit all implementation classes from the same base class,
though, sometimes, it can be helpful to have an abstract base class that
implements some of the common methods of the interface.

As for your form, you can use an adapter class that inherits from
TInterfacedObject.  Take a look at TStreamAdapter for an example.

Dennis.

- Original Message -
From: Trevor Jones [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Thursday, August 08, 2002 1:11 PM
Subject: Re: [DUG]: Interfaces (and classes that support them)


 Phil,
   Thanks for the idea, but it kinda breaks the idea of an Interface being
 supported by *ANY* class type.  In some cases the objects that support the
 interfaces I'm using are subclassed from TInterfacedObject, other times
they
 may be components or even forms. As luck would have it, a TForm does not
 subclass TInterfacedObject, so this stops me using this approach.


   For the moment, I've opted to register factory functions rather than the
 classes themselves and this seems to cover most issues.

 Trevor

 - Original Message -
 From: Phil Middlemiss [EMAIL PROTECTED]
 To: Multiple recipients of list delphi [EMAIL PROTECTED]
 Sent: Thursday, August 08, 2002 8:34 AM
 Subject: Re: [DUG]: Interfaces (and classes that support them)


  Trevor,
 
  I usually create a simple base class with a virtual constructor that I
 then
  descend from where appropriate.
 
  eg.
  TMyObject = class(TInterfacedObject)
  public
  constructor Create; virtual;
  end;
 
  TMyObjectClass = class of TMyObject;
 
  Now everything that needs to can descend from TMyObject, and the
  MyInterfaceClass function uses the variables
 
  AClass: TMyObjectClass;
  AObject: TMyObject;
 
  This assumes, of course, that you have control over which classes are
 used.
 
  Kind regards,
 
  Phil.
 
  - Original Message -
  From: Trevor Jones [EMAIL PROTECTED]
  To: Multiple recipients of list delphi [EMAIL PROTECTED]
  Sent: Wednesday, August 07, 2002 5:03 PM
  Subject: [DUG]: Interfaces (and classes that support them)
 
 
   Hi all,
 One of the things that I like about using Interfaces is that the
 classes
   supporting them can be of any type - Yeeha!
  
   However it can be tricky deciding how to construct an object from just
a
   class reference that supports an interface because the TObject
 constructor
   is not virtual.
  
   My solutions so far amount to stuff like this (where the last
registered
   class is the one to be created):
  
   var
 List : TList;
  
   procedure RegisterMyInterfacedClass(aClass : TClass);
   begin
 if supports(aClass,IMyInterface) then
   List.Add(aClass);
   end;
  
   procedure UnRegisterMyInterfacedClass(aClass : TClass);
   var
 i : integer;
   begin
 i := List.IndexOf(aClass);
 if i = 0 then
 List.Delete(i);
   end;
  
   function MyInterfacedClass : IMyInterface;
   var
 aClass : TClass;
 aObject :  TObject;
   begin
 result := nil;
 if List.Count  0 then
   begin
   aClass := List[List.count-1];
   if aClass.inheritsFrom(TComponent) then
 aObject := TComponentClass(aClass).create(application)
   else
 aObject := TClass.create;
   // Supports should always be true here, its just an easy way to
get
  the
   interface
   if not Supports(aObject, IMyInterface,result) then
 aObject.free;
   end;
   end;
  
  
   All of this nonsense seems to work very well at the moment, but I'm
 unsure
   how safe it is.
  
   The gotchas seem to be:
 If the class inherits only from TInterfacedObject, its specific
   constructor is not called, the class must override AfterConstruction
to
   create any needed bits (like stringlists etc.).
  
 If the class uses some fancy constructor that requires something
other
   than an owner, then I'm stuck.
  
   Does anyone have a more elegant way of going about this that they are
   willing to share?
  
   Trevor
  
  
  
  
 

 --
  -
   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]: Const

2001-11-11 Thread Dennis Chuah


John,

The first form is a typed constant.  Delphi allocates a string variable and
assigns it the value 'This is a test'.  Depending on your compiler options
(Assignable typed constants), Delphi may or may not allow this variable to
be assigned.  When you assign this to another variable, it is done at run
time.

The second form is a simple constant, and is resolved at compile time.  It
cannot be assigned to.

example:

program Test;
{$APPTYPE CONSOLE}
{$J+}
const
  A: string = 'This is a test';
  B = 'This is a test';
var
  s: string;
begin
  s := A;
  WriteLn ('A = ', s);
  s := B;
  WriteLn ('B = ', s);
  A := 'New value';
  s := A;
  WriteLn ('A = ', s);
//  B := 'New value'; will raise compiler error
  s := B;
  WriteLn ('B = ', s);
end.

Typed constants allow variables to be created with an initial value.

Typed constants also allow for static variables inside functions and
procedures.  Example:

procedure DoSomething;
const
  FirstTime: Boolean = True;
begin
  if FirstTime then begin
FirstTime := False;
// Perform initialisation
  end;

  // Perform main task
end;

Regards,
Dennis.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, 13 November 2001 01:30
 To: Multiple recipients of list delphi
 Subject: [DUG]: Const


 Hi all,

 Can anybody tell me the difference between the following two declarations
 and why you want to use the first one. The second one seems to use less
 memory!


   const
  sName : string = 'This is a test';


 and

   const
  sName  = 'This is a test';



 TIA

 John.

 --
 -
 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]: Autosize a TRadioButton

2001-10-16 Thread Dennis Chuah


Don't forget to hook the OnClick event of the label and change the radio
button when it is clicked.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 17 October 2001 13:35
 To: Multiple recipients of list delphi
 Subject: RE: [DUG]: Autosize a TRadioButton


 -- Original Message --
 Hey guys, I'm having a bit of a hard time trying to figure out
 how to autosize a radiobutton.  What I have is a Radiobutton
 component that needs to resize it self depending on the font
 size.  To make things a little more interesting, my radiobutton
 component is multilined.  Any suggestions?
 

 Yea, seperate the RadioButton from the Caption.

 ie; drop a TRadioButton on the form and set it's caption to ''.

 Then drop a TLabel on next to it like it belongs, and set it to
 Autosize and there you have it (trying to autosize a RadioButton
 to that specification is like trying to nail jelly to a tree).

 Don't forget to set the label's thingy to whatsit - So I'm away
 from my Delphi - set it so's if you click on it, it clicks and
 selects the RadioButton, that way it not only looks like part of
 the RadioButton, it acts like it too.

 Steve
 --
 -
 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]: MDI

2001-10-09 Thread Dennis Chuah


Robert,

Hi.  That unfortunately is the nature of MDI - I tend to stay away from MDI
these days.  In any case, you can make your child forms remember which state
they were in before, and when they next get activated, they can restore
themselves to their last state.  The alternative is to disable the maximise
functionality and make all maximised forms take up the full client area of
the main form.

Regards,
Dennis.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 10 October 2001 06:27
To: Multiple recipients of list delphi
Subject: [DUG]: MDI


We have an MDI app where most of our forms are maximised.  When the user
opens a non maximised child Windows automatically changes all other forms to
non maximised and reduces their size.  Does anyone know how to get around
this behaviour?


Robert Martin
Software Engineer
Wild Software 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
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



[DUG]: Interesting Delphi 5 compiler bug

2001-09-25 Thread Dennis Chuah


The following compiles with an error in D5.

type
  TSomeObject = class
  private
procedure GetA (msg: TMessage); overload; message 1;
function GetA: Integer; overload;
  public
property A: Integer read GetA;
  end;

It seems like D5's compiler is not able to correctly resolve the overloaded
property access method.

Regards,
Dennis.

---
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]: Interesting Delphi 5 compiler bug

2001-09-25 Thread Dennis Chuah


You cannot overload a function based on the function result alone.  This
because the compiler allows you to call the function without having to
assign the result to a variable.  Even if it forces you to do so, allowing
overloading on function result is difficult at best, eg. if you have one
function returning a string and another returning a pointer.  If you call
the string function and cast the result as a PChar, how should the compiler
interpret that?  Should it call the function that returns the pointer, or
should it call the function that returns a string and then cast it to a
PChar?

Regards,
Dennis.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 26 September 2001 14:23
 To: Multiple recipients of list delphi
 Subject: RE: [DUG]: Interesting Delphi 5 compiler bug


 Thankfully,
 The method overloading in D6 is much better (eg Strings and WideString
 method overloads now work). I think the function result is still
 not checked
 in D6.
 Myles.


 -Original Message-
 From: Dennis Chuah [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 26 September 2001 1:39 p.m.
 To: Multiple recipients of list delphi
 Subject: [DUG]: Interesting Delphi 5 compiler bug



 The following compiles with an error in D5.

 type
   TSomeObject = class
   private
 procedure GetA (msg: TMessage); overload; message 1;
 function GetA: Integer; overload;
   public
 property A: Integer read GetA;
   end;

 It seems like D5's compiler is not able to correctly resolve the
 overloaded
 property access method.

 Regards,
 Dennis.

---
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]: RadioButton requires 2 clicks

2001-09-24 Thread Dennis Chuah


Steve,

The OnExit event is called if the control loses the focus to another control
on the same form.  The WM_KILLFOCUS message is handled by the base class and
if the above condition is met, it fires off the OnExit event.  Like all
Windows applications, you will encounter problems if you cause the focus to
change in the WM_KILLFOCUS event.

When you display the MessageDlg in the event, in effect, you cause the focus
to be changed from the radio button to the message dialog.  This is the
cause of your problem.

I suggest the following solution:

1.  In you OnExit event set a flag to indicate that you need to display a
message.

2.  Hook the OnUpdate event of an action on the form (if you don't use
actions, now is a good time to start).

3.  Check for the flag in the action and display the dialog.  Don't forget
to unset the flag.

Regards,
Dennis.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 25 September 2001 11:10
To: Multiple recipients of list delphi
Subject: [DUG]: RadioButton requires 2 clicks


I posted this problem yesterday but got no response so I have attempted to
explain it better.

I have a D6 application.

When I move out of a TEdit by clicking on a TRadioButton or TCheckBox, the
OnExit code for the TEdit executes and the focus moves to the TRadioButton
or TCheckBox but the OnClick event for the TRadioButton or TCheckBox does
not execute - the button initially appears grayed, but reverts to the normal
colour and remains unchecked as soon as the mouse is moved. To make the
TRadioButton or TCheckBox checked you need to click it a second time - even
if you want to close the form you need to click the close button twice.

The problem only arises when the OnExit event from the TEdit displays a
MessageDlg - there is no problem if the MessageDlg does not get displayed,
so I suspect the problem lies with MessageDlg.

I have tried putting Application.ProcessMessages and forcing a click using
SendMessage in various places without success.

Anyone got any ideas on how to fix this problem?

Regards
Steve Galyer

---
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-13 Thread Dennis Chuah


 Use native drivers.

Don't use the native SQL Server driver as it is slow and full of bugs.

Also, if you use dbgrids and client side cursors, it keeps record locks on
SQL server until the user scrolls to the end of the recordset.  This can
then cause problems on other machines needing to write to the locked
records.  I have found that you should either keep the recordsets small and
scroll to the end, or else, use a snapshot recordset (eg. on a temporary
table).

Regards,
Dennis.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, 13 September 2001 22:56
 To: Multiple recipients of list delphi
 Subject: RE: [DUG]: Interbase X SQL Server



 The hstmt error is endemic to odbc.  It is caused by having more than one
 active query at a time (an active query is one which has not retrieved all
 it's rows).

 To mitigate this try the following:
 For queries, do a FetchAll in the OnOpen event.

 Use multiple database components.

 Use multiple sessions.

 Use ttables rather than queries (I know) as ttables create their own
 connections.

 Use native drivers.

 Use ado

 Use interbase.

 Hope this helps.

 REgards

 Sean

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
 Behalf Of Paul Mostek
 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/

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: 

RE: [DUG]: [Off Topic] Anyone know of an Entry Level position..

2001-09-11 Thread Dennis Chuah


Matt,

Hi.  You might like to send your CV to [EMAIL PROTECTED]

Regards,
Dennis.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, 10 September 2001 18:28
To: Multiple recipients of list delphi
Subject: [DUG]: [Off Topic] Anyone know of an Entry Level position..


For a student still finishing off his degree? Sorry to ask here its just i
dont find many ads, if any offering entry level positions for a delphi
developer. I pretty much just want a chance to actually apply for such a
position, but there really isnt any ever advertised.

Matt Evans

---
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-08-26 Thread Dennis Chuah


Ross,

You don't have to because Free is a static class procedure defined in
TObject, even if you cast the object, it would not have made a difference,
except if you reintroduced Free in your class.  However, I would like to
point out a related issue.  The default destructor of TObject (Destroy) is
virtual.  This means in your class, if you declare a destructor, you must
make sure you override the destructor (use the override keyword), or your
destructor will not be called.  The compiler will generate a warning message
in any case.

Regards,
Dennis.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Monday, 27 August 2001 10:42
 To: Multiple recipients of list delphi
 Subject: [DUG]: Destroying Objects


 A simple yes/no question.

 Should I cast an object to it's defined type before I Free it?
 ie. MyObject(ListBox.Items.Objects[0]).Free
or simply ListBox.Items.Objects[0].Free will do?

 Cheers,
 Ross.
 --
 -
 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]: TDataset - Recordcount

2001-08-23 Thread Dennis Chuah


I would change the query and do:

Select count(*) as RecordCount from myTable where ID = 1

Then look at the value of the RecordCount field.

Regards,
Dennis.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, 24 August 2001 08:45
To: Multiple recipients of list delphi
Subject: [DUG]: TDataset - Recordcount


If I have a TQuery with a select statement like 'Select ID from myTable
where ID = 1' am I correct in assuming that the best way to verify that
there is a record (or more than 1) with ID = 1 is to test the Recordcount
property?

The reason I ask is that if all I am interested in is the fact that there
are more than 0 records then the Recordcount method seems overkill (as at
some point the entire recordset is navigated which in the case of a large
recordset is time consuming).

...I guess I can override recordcount or implement my own method but before
I do this thought I should double check.

Thanks

---
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]: Intermediate Delphi developer wanted

2001-08-12 Thread Dennis Chuah


Delphi Programmer
-

Genie Systems is a fast growing international software organization
providing Commerce, Collaboration and Exchange® applications targeted at
sub $1 billion corporations and divisions of Fortune500 corporations. Our
applications provide access and integration for these clients to the
emerging world of Web Services and interoperable business applications.

We are seeking a Delphi Programmer with the following skills:

·2+ yrs OO Delphi
·Good SQL skills
·Any web experience
·Good backend experience

Ideally you would also have UML experience and some exposure to Java.

This position is an integral part of our on-going middleware development.
You will have a broad range of responsibilities and involvement in all
aspects of the software development life cycle.

Be an important part of our team!

Call Greg Allum on 09 358 3310 or send your CV to [EMAIL PROTECTED]

---
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/



  1   2   3   4   >