RE: What is the best way to add objects to TMemo.Lines

2012-12-14 Thread Stephen Posey
OK, if THAT's the case, then I think you might be better served with a ListBox 
in any case, which has much better support for the TStrings.Objects property 
and is much easier to implement item/line reordering and deletion logic.

If you're determined to use a Memo, then I'd suggest storing the text and 
objects in a TStringList, which you then assign the strings to the Memo lines.

When the lines are reordered in or dropped from the Memo, then swap/drop the 
same numbered strings/objects in the TStringList.

Make sense?

Stephen Posey
stephenlpo...@earthlink.net 

-Original Message-
>From: John Barrat 
>Sent: Dec 13, 2012 4:04 AM
>To: 'Moderated List for the Discussion of Delphi Programming
>   excluding   Database-related topics' 
>Subject: RE: What is the best way to add objects to TMemo.Lines
>
>No the only things allowed are to re-order (drag and drop) and delete - I
>cannot see why that should affect the objects or am I missing something?
>
>JohnB
>
>-Original Message-
>From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf
>Of Stephen Posey
>Sent: 12 December 2012 15:12
>To: Moderated List for the Discussion of Delphi Programming excluding
>Database-related topics
>Subject: Re: What is the best way to add objects to TMemo.Lines
>
>Are you going to allow the text in the Memo to be edited? 
>
>If so, what are the implications for the associated objects if the number of
>lines changes (e.g. someone inserts a line break, types in one or more
>lines, or deletes one or more lines)?
>
>Stephen Posey
>stephenlpo...@earthlink.net 
>
>-Original Message-
>>From: John Barrat 
>>Sent: Dec 11, 2012 11:38 AM
>>To: 'Moderated List for the Discussion of Delphi Programming
>>  excluding   Database-related topics' 
>>Subject: What is the best way to add objects to TMemo.Lines
>>
>>I seems TMemo.lines only supports the String part of a TStrings not the 
>>Objects.
>>
>>TMemo.Lines.AddObject compiles fine in fact only the string component 
>>is actually loaded.
>>
>> 
>>
>>I need to store an object with this TMemo - how do you recommend I do this?
>>
>> 
>>
>>JohnB
>>
>>___
>>Delphi mailing list
>>Delphi@elists.org
>>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
>___
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
>___
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: What is the best way to add objects to TMemo.Lines

2012-12-13 Thread Stephen Posey
Are you going to allow the text in the Memo to be edited? 

If so, what are the implications for the associated objects if the number of 
lines changes (e.g. someone inserts a line break, types in one or more lines, 
or deletes one or more lines)?

Stephen Posey
stephenlpo...@earthlink.net 

-Original Message-
>From: John Barrat 
>Sent: Dec 11, 2012 11:38 AM
>To: 'Moderated List for the Discussion of Delphi Programming
>   excluding   Database-related topics' 
>Subject: What is the best way to add objects to TMemo.Lines
>
>I seems TMemo.lines only supports the String part of a TStrings not the
>Objects.
>
>TMemo.Lines.AddObject compiles fine in fact only the string component is
>actually loaded.
>
> 
>
>I need to store an object with this TMemo - how do you recommend I do this?
>
> 
>
>JohnB
>
>___
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


RE: Previous Parameters list

2012-10-09 Thread Stephen Posey
OK, now I understand the problem.

You can delete or modify the items available in the parameter drop-down by 
editing Delphi's Registry entries.

Look under HKEY_CURRENT_USER\Software\Borland\\\History 
Lists\hlRunParameters

If you remove or add items, be sure to update the Count value appropriately. 
The IDE is probably robust enough not to choke if there's a mis-match, but why 
tempt fate?

HTH

Stephen Posey
stephenlpo...@earthlink.net 


-Original Message-
>From: chris.mo...@biuk.co.uk
>Sent: Oct 8, 2012 7:33 AM
>To: delphi@elists.org
>Subject: RE: Previous Parameters list
>
>Yes
>I open Run -> Parameters
>In the "Run Parameters" dialog, there is a drop-down list called
>Parameters that contains every parameter I have ever created since the
>dawn of time.  Most useful.
>
>Now I only want to use 4 of those parameters, so I would like VERY MUCH
>to please clear that list and start again.
>
>If I click HELP it tells me that Parameters are command line arguments,
>again, most useful.
>
>However, when there are 40 of them, all more than 80 characters in
>length, and each one differing only by one or two characters, the
>usefulness starts to thin. 
>
>As simply as I can : I would like to clear the list of the parameter
>dropdown in the "Run Parameters" dialog of Delphi 7. 
>
>-Original Message-
>From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On
>Behalf Of Tom Hansen
>Sent: 05 October 2012 13:33
>To: Moderated List for the Discussion of Delphi Programming
>excludingDatabase-related topics
>Subject: Re: Previos Parameters list
>
>Am I right that you just want to clear the history list?
>-Tom Hansen
>
>On Wed, Oct 3, 2012 at 5:08 AM,  wrote:
>
>> Hello,
>>
>>
>>
>> Really simple one.  Using Delphi 7 I have an app that I send 
>> parameters to.  In the development stage, I made many, many changes to
>
>> the parameters.  Now I have a set of 4 that I wish to use going
>forward.
>>
>>
>>
>> My parameter list has ALL of the previous parameters in it.  How can I
>
>> clear the list?  Do you know where the list data is kept?
>>
>>
>>
>> Thanks - Chris.
>>
>>
>>
>> BROTHER INDUSTRIES (UK) LTD
>>
>> Registered 153 in England.
>>
>> VAT No : 864 4502 20
>>
>>
>>
>> Address :
>>
>> Vauxhall Industrial Estate
>> Ruabon
>> Wrexham
>> LL14 6HA
>>
>> ___
>> Delphi mailing list
>> Delphi@elists.org
>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>>
>___
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
>___
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: Previos Parameters list

2012-10-05 Thread Stephen Posey
If I understand the question: In the Delphi IDE, you specify the parameters to 
run the application with under Run>Parameters.

Is that what you're after?

Stephen Posey
stephenlpo...@earthlink.net 

-Original Message-
>From: chris.mo...@biuk.co.uk
>Sent: Oct 3, 2012 5:08 AM
>To: delphi@elists.org
>Subject: Previos Parameters list
>
>Hello,
>
> 
>
>Really simple one.  Using Delphi 7 I have an app that I send parameters
>to.  In the development stage, I made many, many changes to the
>parameters.  Now I have a set of 4 that I wish to use going forward.
>
>My parameter list has ALL of the previous parameters in it.  How can I
>clear the list?  Do you know where the list data is kept?
>
>Thanks - Chris.

___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: D4 Canvas.TextWidth question

2011-11-03 Thread Stephen Posey
I'd just call the relevant Windows API, which in this case appears to be 
GetTextExtentPoint32().

http://msdn.microsoft.com/en-us/library/dd144938(v=vs.85).aspx

HTH

Stephen Posey
stephenlpo...@earthlink.net 


-Original Message-
>From: Peter Kapas 
>Sent: Nov 1, 2011 12:20 PM
>To: delphi@elists.org
>Subject: D4 Canvas.TextWidth question
>
>Hi,
>
>How to solve the bug of D4 for TComboBox.Canvas.TextWidth. It does not work. 
>Of course it works in D7 and above, but I have only D4. Is there some function 
>to get CharWidth for any different Fonts?
>
>Thanks,
>Peter
>
>___
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: Strange loop behaviour [repeat loop]

2011-06-06 Thread Stephen Posey
Sounds like there's something different about the last lines that are causing 
the problem. 

Is it consistently the same data files that produce the effect?

A few other things occur to me, but without seeing your code or example data 
it's a little hard to judge exactly what the problem might be.

If you care to provide some more context and details I'll attempt to diagnose 
further.

Regards,

Stephen Posey
stephenlpo...@earthlink.net 

-Original Message-
>From: n...@nrbs.com
>Sent: Jun 4, 2011 4:41 AM
>To: Delphi request 
>Subject: Strange loop behaviour [repeat loop]
>
>Hi
>
>I have a program that reads PCL data and converts to bitmaps.
>I am using a stringlist for this data. I read the strings and convert
>them to binary, loop through the binary lines and draw black pixels
>for 1s and white pixels for 0s.
>
>The program works and is very fast. However, sometimes the LAST
>line is skipped when converting to dots.
>
>I have created a strings object where I write each line of data just
>after convertion to dots. This registers correctly so I know that my
>data is not corrupt when the routine reads the strings.
>
>Typically, there are between 3 and 40 lines for each character
>and each line contains around 36  elements of 1s or 0s.
>
>I have checked all initial values before drawing on the bitmap
>canvas using canvas.fillrect.
>
>The problem is this error only happens sometimes, [but always
>the same files]. I have checked these files using a hex editor and
>the data is definitely present.
>
>Any thoughts would be extremely welcome.
>
>Thanks in advance
>
>Neil
>
>
>
>
>___
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: Recognition ov application window

2010-10-15 Thread Stephen Posey
I'm forwarding a small project to your direct Email that should (FLW) compile 
and behave identically in Delphi 4 as it does in Delphi 2007 (which I'm 
currently using).

What SHOULD happen is the client area will turn Red when the mouse pointer is 
over the form client area, and turn back to its original color when the mouse 
pointer leaves the client area. 

It shouldn't matter whether the form has focus or is partially obscured by 
another window. 

LMK if you have any trouble getting it to compile and run.

Stephen Posey
stephenlpo...@earthlink.net 


-Original Message-
>From: Peter Kapas 
>Sent: Oct 14, 2010 4:21 AM
>To: Moderated List for the Discussion of Delphi Programming
>   excludingDatabase-related topics 
>Subject: Re: Recognition ov application window
>
>Stephan,
>
>Thanks. I tried it - nothing happened. Maybe something missing from the 
>code?
>
>If I do it in:  TForm1 = Class(TForm) I see action only if I declare: 
>Application.OnActivate := ...
>and Application.OnDeactivate in TForm1.FormCreate(Sender ...). But!!! it 
>happen only, if
>I click on the Form, or outside of the Form. Nothing happen, if I only move 
>the mouse over the Windows / Desktop ... etc.
>There are some Mouse. functions to get the point coordinates. The only 
>problem is: if the form covered
>by the no-Delphi application window, that window is "transparent" for the 
>mouse - what I do not want. I want
>to recognize my application's window only in case, if the cursor is over on 
>the visible part of the application's
>window.
>
>Please, verify your code, maybe something is needed to be present to make 
>"sensitive" the mouse without
>click-click-click   :)
>
>Peter
>
>
>
>- Original Message - 
>From: "Peter Kapas" 
>To: "Moderated List for the Discussion of Delphi 
>ProgrammingexcludingDatabase-related topics" 
>Sent: Tuesday, October 12, 2010 6:23 AM
>Subject: Re: Recognition ov application window
>
>
>> Stephen,
>>
>> Thanks. I have to try again, because I did it similarly and it was not 
>> that, what I expected.
>> This is the reason, why I am asking for it again and again. I have older 
>> Delphi 4. Maybe
>> something is wrong in this version? I updated it with patches found before 
>> on the
>> Company's website.
>>
>> Peter
>>
>>
>> - Original Message - 
>> From: "Stephen Posey" 
>> To: "Moderated List for the Discussion of Delphi Programming 
>> excludingDatabase-related topics" 
>> Sent: Monday, October 11, 2010 5:59 AM
>> Subject: Re: Recognition ov application window
>>
>>
>>> OnMouseEnter and OnMouseLeave don't have anything to do with clicking on 
>>> the window per se; they provide notification when the mouse enters or 
>>> leaves the window's client area; regardless of whether the window has 
>>> focus.
>>>
>>> Here's a simple test I tried:
>>>
>>> unit mouseOverU1;
>>>
>>> interface
>>>
>>> uses
>>>  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, 
>>> Forms,
>>>  Dialogs;
>>>
>>> type
>>>  TfrmTestMouseOver = class(TForm)
>>>procedure FormMouseEnter(Sender: TObject);
>>>procedure FormMouseLeave(Sender: TObject);
>>>  private
>>>{ Private declarations }
>>>  protected
>>>  public
>>>{ Public declarations }
>>>  end;
>>>
>>> var
>>>  frmTestMouseOver: TfrmTestMouseOver;
>>>
>>> implementation
>>>
>>> {$R *.dfm}
>>>
>>> { TfrmTestMouseOver }
>>>
>>> procedure TfrmTestMouseOver.FormMouseEnter(Sender: TObject);
>>> begin
>>>  Self.Color := clRed;
>>> end;
>>>
>>> procedure TfrmTestMouseOver.FormMouseLeave(Sender: TObject);
>>> begin
>>>  Self.Color := clBtnFace;
>>> end;
>>>
>>> end.
>>>
>>> The color change works whether or not the window has focus or is 
>>> partially obscured by other windows.
>>>
>>> You also get MouseMove events without the window having focus, try 
>>> something like this:
>>>
>>> procedure TfrmTestMouseOver.FormMouseMove(Sender: TObject; Shift: 
>>> TShiftState; X, Y: Integer);
>>> begin
>>>  Self.Color := RGB(X mod 255, y mod 255, Random(255));
>>> end;
>>>
>>>
>>> Does that help any?
>>>
>>> Stephen

Re: Recognition ov application window

2010-10-14 Thread Stephen Posey
I missed the part about your using Delphi 4. 

Just in case there's still any confusion: OnMouseEnter/OnMouseLeave are NOT the 
same as OnMouseDown/OnMouseUp.

I don't recall whether the D4 version of TForm implements 
OnMouseEnter/OnMouseLeave, does it?

If not, I'm quite sure it DOES support the internal VCL notification messages 
that underlie those events; so equivalents to OnMouseEnter and OnMouseLeave can 
be created for your D4 TForm descendant.

LMK if you want the information on how to do that.

stephen

Stephen Posey
stephenlpo...@earthlink.net 




-Original Message-
>From: Peter Kapas 
>Sent: Oct 12, 2010 9:23 AM
>To: Moderated List for the Discussion of Delphi Programming
>   excludingDatabase-related topics 
>Subject: Re: Recognition ov application window
>
>Stephen,
>
>Thanks. I have to try again, because I did it similarly and it was not that, 
>what I expected.
>This is the reason, why I am asking for it again and again. I have older 
>Delphi 4. Maybe
>something is wrong in this version? I updated it with patches found before 
>on the
>Company's website.
>
>Peter
>
>
>- Original Message - 
>From: "Stephen Posey" 
>To: "Moderated List for the Discussion of Delphi Programming 
>excludingDatabase-related topics" 
>Sent: Monday, October 11, 2010 5:59 AM
>Subject: Re: Recognition ov application window
>
>
>> OnMouseEnter and OnMouseLeave don't have anything to do with clicking on 
>> the window per se; they provide notification when the mouse enters or 
>> leaves the window's client area; regardless of whether the window has 
>> focus.
>>
>> Here's a simple test I tried:
>>
>> unit mouseOverU1;
>>
>> interface
>>
>> uses
>>  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, 
>> Forms,
>>  Dialogs;
>>
>> type
>>  TfrmTestMouseOver = class(TForm)
>>procedure FormMouseEnter(Sender: TObject);
>>procedure FormMouseLeave(Sender: TObject);
>>  private
>>{ Private declarations }
>>  protected
>>  public
>>{ Public declarations }
>>  end;
>>
>> var
>>  frmTestMouseOver: TfrmTestMouseOver;
>>
>> implementation
>>
>> {$R *.dfm}
>>
>> { TfrmTestMouseOver }
>>
>> procedure TfrmTestMouseOver.FormMouseEnter(Sender: TObject);
>> begin
>>  Self.Color := clRed;
>> end;
>>
>> procedure TfrmTestMouseOver.FormMouseLeave(Sender: TObject);
>> begin
>>  Self.Color := clBtnFace;
>> end;
>>
>> end.
>>
>> The color change works whether or not the window has focus or is partially 
>> obscured by other windows.
>>
>> You also get MouseMove events without the window having focus, try 
>> something like this:
>>
>> procedure TfrmTestMouseOver.FormMouseMove(Sender: TObject; Shift: 
>> TShiftState; X, Y: Integer);
>> begin
>>  Self.Color := RGB(X mod 255, y mod 255, Random(255));
>> end;
>>
>>
>> Does that help any?
>>
>> Stephen Posey
>> stephenlpo...@earthlink.net
>>
>>
>> -Original Message-
>>>From: Peter Kapas 
>>>Sent: Oct 10, 2010 11:38 AM
>>>To: Moderated List for the Discussion of Delphi Programming
>>> excludingDatabase-related topics 
>>>Subject: Re: Recognition ov application window
>>>
>>>Hi Stephen,
>>>
>>>Off course, it works if I click on the window. I want to solve the 
>>>problem,
>>>when I move Mouse over the window. I am looking for an indicator, where
>>>I can take the info about the object under the moving cursor.
>>>
>>>Similar - what you advise - is the : Form1.Active, but not really that, 
>>>what
>>>I
>>>am looking for.
>>>
>>>Peter
>>>
>>>- Original Message - 
>>>From: "Stephen Posey" 
>>>To: "Moderated List for the Discussion of Delphi Programming
>>>excludingDatabase-related topics" 
>>>Sent: Saturday, October 09, 2010 4:17 PM
>>>Subject: Re: Recognition ov application window
>>>
>>>
>>>> Have you tried the OnMouseEnter and OnMouseLeave events?
>>>>
>>>> Stephen Posey
>>>> stephenlpo...@earthlink.net
>>>>
>>>>
>>>> -Original Message-
>>>>>From: Peter Kapas 
>>>>>Sent: Oct 9, 2010 10:16 AM
>>>>>To: Delphi@elists.org
>>>>>Subject: Re: Recognition ov application window
>>>&

Re: Recognition ov application window

2010-10-12 Thread Stephen Posey
OnMouseEnter and OnMouseLeave don't have anything to do with clicking on the 
window per se; they provide notification when the mouse enters or leaves the 
window's client area; regardless of whether the window has focus.

Here's a simple test I tried:

unit mouseOverU1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TfrmTestMouseOver = class(TForm)
procedure FormMouseEnter(Sender: TObject);
procedure FormMouseLeave(Sender: TObject);
  private
{ Private declarations }
  protected
  public
{ Public declarations }
  end;

var
  frmTestMouseOver: TfrmTestMouseOver;

implementation

{$R *.dfm}

{ TfrmTestMouseOver }

procedure TfrmTestMouseOver.FormMouseEnter(Sender: TObject);
begin
  Self.Color := clRed;
end;

procedure TfrmTestMouseOver.FormMouseLeave(Sender: TObject);
begin
  Self.Color := clBtnFace;
end;

end.

The color change works whether or not the window has focus or is partially 
obscured by other windows.

You also get MouseMove events without the window having focus, try something 
like this:

procedure TfrmTestMouseOver.FormMouseMove(Sender: TObject; Shift: TShiftState; 
X, Y: Integer);
begin
  Self.Color := RGB(X mod 255, y mod 255, Random(255));
end;


Does that help any?

Stephen Posey
stephenlpo...@earthlink.net 


-Original Message-
>From: Peter Kapas 
>Sent: Oct 10, 2010 11:38 AM
>To: Moderated List for the Discussion of Delphi Programming
>   excludingDatabase-related topics 
>Subject: Re: Recognition ov application window
>
>Hi Stephen,
>
>Off course, it works if I click on the window. I want to solve the problem,
>when I move Mouse over the window. I am looking for an indicator, where
>I can take the info about the object under the moving cursor.
>
>Similar - what you advise - is the : Form1.Active, but not really that, what 
>I
>am looking for.
>
>Peter
>
>- Original Message - 
>From: "Stephen Posey" 
>To: "Moderated List for the Discussion of Delphi Programming 
>excludingDatabase-related topics" 
>Sent: Saturday, October 09, 2010 4:17 PM
>Subject: Re: Recognition ov application window
>
>
>> Have you tried the OnMouseEnter and OnMouseLeave events?
>>
>> Stephen Posey
>> stephenlpo...@earthlink.net
>>
>>
>> -Original Message-
>>>From: Peter Kapas 
>>>Sent: Oct 9, 2010 10:16 AM
>>>To: Delphi@elists.org
>>>Subject: Re: Recognition ov application window
>>>
>>>Hi Francois,
>>>
>>>Thanks, I already tried it. There are a few standard mouse functions to 
>>>simplify that,
>>>but the major problem is, when the application window is partly covered by 
>>>the other
>>>Windows applications and I cannot mask the area to say "I do not see
>>>my application, set-up indicator to False, if for seeing that is True).
>>>---
>>>Peter
>>>---
>>>> I would like to find method how to recognize, the mouse is over my
>>>> application window. If that window is partly covered by other 
>>>> application,
>>>> I want to recognize that situation, in other words, that time, I want 
>>>> see
>>>> some indicator, which tells me, between mouse cursor and my application
>>>> window is something. How to do it?  (I am using Delphi 4).
>>>
>>>Just an idea, not tested.
>>>Install a mouse hook to get the mouse movements whatever application is
>>>above your's. Then knowing the area(s) where you application is, you can
>>>compute if the mouse is within or not, even if your app is behind another
>>>other one.
>>>
>>>___
>>>Delphi mailing list
>>>Delphi@elists.org
>>>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>>
>> ___
>> Delphi mailing list
>> Delphi@elists.org
>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi 
>
>___
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: Recognition ov application window

2010-10-10 Thread Stephen Posey
Have you tried the OnMouseEnter and OnMouseLeave events?

Stephen Posey
stephenlpo...@earthlink.net 


-Original Message-
>From: Peter Kapas 
>Sent: Oct 9, 2010 10:16 AM
>To: Delphi@elists.org
>Subject: Re: Recognition ov application window
>
>Hi Francois,
>
>Thanks, I already tried it. There are a few standard mouse functions to 
>simplify that,
>but the major problem is, when the application window is partly covered by the 
>other 
>Windows applications and I cannot mask the area to say "I do not see
>my application, set-up indicator to False, if for seeing that is True).
>---
>Peter
>---
>> I would like to find method how to recognize, the mouse is over my
>> application window. If that window is partly covered by other application,
>> I want to recognize that situation, in other words, that time, I want see
>> some indicator, which tells me, between mouse cursor and my application
>> window is something. How to do it?  (I am using Delphi 4).
>
>Just an idea, not tested.
>Install a mouse hook to get the mouse movements whatever application is 
>above your's. Then knowing the area(s) where you application is, you can 
>compute if the mouse is within or not, even if your app is behind another 
>other one.
>
>___
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: Looking for some WinAPI help - Again!

2010-06-29 Thread Stephen Posey
-Original Message-
>From: John Barrat 
>Sent: Jun 27, 2010 4:32 AM
>To: delphi@elists.org
>Subject: Looking for some WinAPI help - Again!
>
>On your previous advice I have been looking at the GetWindow and
>EnumChildWindows API calls but am getting some od results.
>
>The application I was trying to get window handles to does not report any
>child windows using the EnumChildWindows  call or GetWindow with the
>GW_CHILD command set.
>
>However, other applications do return their child windows through these API
>calls.
>
>I cannot find any consistency in this behaviour with some applications it
>works others it doesn't.
>
>When I run WinID  by Dennis A Babkin and hover the mouse over those
>applications which seemingly don't report their child handles through the
>API this picks up the structure correctly and confirms the relationship of
>control to the application. What am I missing,

That's peculiar. Is there anything unusual about this application?

Off the top of my head, the only explanations I can think of are:

1. If the application is drawing its entire interface by hand without creating 
any child windowed controls.
2. If the application represents some kind of display client and the interface 
drawing is all being done elsewhere and sent in bulk to the application's 
display area.

Is something like one of those a possibility?


Stephen Posey
stephenlpo...@earthlink.net 


___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: Looking for some WinAPI help

2010-06-22 Thread Stephen Posey



-Original Message-
>From: John Barrat 
>Sent: Jun 21, 2010 4:24 PM
>To: delphi@elists.org
>Subject: Looking for some WinAPI help
>
>I want to get the window properties of a 3rd party SDI application.
>
> 
>
>I know the handle to the Application, I get that through using the
>GetWindow() and GetWindowText() API calls but is there a way of discovering
>the handles to other windows in the application - e.g. the applications
>editing area.  Would the GW_CHILD command parameter for example get me all
>the windows in the client area of the application window?

GetWindow()/GetWindowText() by itself is not going to get you where it sounds 
like you want to go. 

The usual approach for what you describe is once you have the parent window 
handle, you enumerate all of its registered child windows using the 
EnumChildWindows() API.

You pass a callback function reference to EnumChildWindows() in which you can 
examine the characteristics of the child windows returned by using the 
GetWindowLong() API.

Note that this parent->child window relationship is hierarchical; you may have 
to call EnumWindows() again on child window handles you receive from the parent 
(and then on those handles as well, etc., etc.) in order to drill down to the 
window(s) of actual interest.

HTH

Stephen Posey
stephenlpo...@earthlink.net 

___
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: Multi dimensional Varient arrays.

2009-06-13 Thread Stephen Posey

John Dammeyer wrote:

Hi,

Delphi 5.

I'm working with National Instruments ActiveX controls and specifically
their CWGraph.ChartY function.

I'd like to chart two traces but I can't figure out how to make up a two
dimensional array to pass to the function.  


Here's what I have to plot one trace:

ClippedArray : array of Variant;  // Definition.
...
ClippedArray := VarArrayCreate([0,SAMPLE_SIZE],varVariant); //
Creation.
...
ClippedArray[k] := data;// data added to array.
...
FilteredDataGraph.chartY( ClippedArray ); // Data displayed on chart.

Since National Instruments doesn't really support Delphi I can't find
anything that points me in the right direction.  


Any suggestions?

Thanks

John
I'm going to guess that NI provided a C/C++ interface library to one or 
more .DLLs (or is it an ActiveX control?); and you're working from 
examples in those languages?


Can you post some equivalent C/C++ code to what you're trying to 
accomplish so I can see how they're expecting the arrays to be declared 
and passed?


Stephen Posey
stephenlpo...@earthlink.net


___
Delphi mailing list -> Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: Generics in D2009

2009-04-26 Thread Stephen Posey
Robert Meek wrote:
>   Even though I had done some limited work using Oxygene, ( now Delphi
> Prism ), I never got into or even tried to make use of Generics.  There was
> too much to learn in .NET already so I was saving them for after I became
> comfortable with it.
> Now however, and since Delphi has gone to a lot of trouble to include them,
> I figured it was time to take a good look at them.  Once again though,
> Cantu's D2009 handbook and his theoretical approach to Generics has left me
> a little cold.
>   It's easy enough to create and instantiate a Generic Class all
> right, but at the same time, the mere fact that once a Generic Type has been
> set for that class you cannot alter it leaves me wondering exactly when and
> why I would put this language feature to practical use...if of course, that
> is truly how Generics work!   
>   In this example:
>
> type
> TSampleClass  = class
> private
> data: T;
> public
> function GetDataSize: Integer;
> function GetDataName: string;
> end;
> function TSampleClass.GetDataSize: Integer;
> begin
> Result := SizeOf (T);
> end;
> function TSampleClass.GetDataName: string;
> begin
> Result := GetTypeName (TypeInfo (T));
> end;
> end;
>
>   Am I correct in assuming that 'data : T;' cannot be altered to a
> different type once the class is created and a value/Type is given to 'T',
> because that is how it came across to me despite it not seeming to make much
> sense!  If such is the case why would I even bother using a Generic Class?
>   If on the other hand, I created an instance of the class and gave
> 'T' a value of '0' or 'nil', depending upon the type of data I wish to pass
> it, then I could write a procedure that first sets the Value/Type of 'T' to
> any I want to at the moment, and then call the three class functions from
> within, it would be possible for me to reset 'T' to a different Value/Type
> each time I call this procedure!  THAT I can see as being very useful!  
>   Which of these is true?  I'm hoping I missed something along the way
> and the latter description of a Generic Class's use is correct or at least
> closer to the truth!
>   
Your statements say to me that you're missing the point and value of 
generics: they allow you to write /generic /code in a type safe fashion.

The typical use of generics involves common data structures (e.g. 
queues, stacks, trees),  with generics these can be written once using 
type generic code such as you describe, and then be applied to whatever 
sort of data might be desirable to store in them without having to fully 
specify the types ahead of time.

Type specification occurs when the generic is /instantiated/. 
Instantiation generates a new type that cannot be used with anything but 
the type(s) specified at instantiation (type safety).

This is in contrast to older approaches that involved collections of 
pointers or object references that could be used to store /anything 
/(potentially leading to hard to track type bugs), or creating custom 
descendants or wrappers to restrict the types (a repetitive and labor 
intensive process with much code duplication).

Does that help?

Stephen Posey
stephenlpo...@earthlink.net

___
Delphi mailing list -> Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: Delphi app playing minesweeper

2007-12-30 Thread Stephen Posey
Rich Cooper wrote:
> Hi Delphians,
> 
> Using D7 and (gasp) Vista, I would like to write an experimental app that
> plays minesweeper.  I suppose I could simulate it in Delphi and build around
> that, but I would prefer to write an app that uses the 16 high by 30 wide
> configuration of minesweeper itself.  
> 
> The app should be able to manage an x,y grid of 16 by 30.  It should be able
> to sense the state of each cell (unknown, or a number of mines near the
> cell), mark a cell as suspicious, select and click on a specific cell by x,y
> coordinate.  
> 
> This capability should ideally be a small app to write.  I want to try out
> various search strategies and other things in Delphi and then try out a
> sequence of moves in procedures for the experiment.  
> 
> Has anyone already done this?  Is there a component or activex that can do
> the job?  
> 
> Suggestions appreciated,
> Rich

There's at least a couple of Delphi implementations of 
Minesweeper available on the NET:

http://delphi.about.com/od/gameprogramming/ss/minesweeper.htm
http://www.delphidabbler.com/software/boobytrap/main?mid=2

I also have one I downloaded from somewhere years ago, I don't 
recall precisely where I got it, but it's visually and 
behaviorally a virtual clone of the Win95 version of Minesweeper.

LMK if you want that one too and I'll forward it.

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi


Re: D2007 and LockBox

2007-09-20 Thread Stephen Posey
Sorry I didn't respond sooner, I've been away from Email for a 
few days.


Robert Meek wrote:


Hi Stephen,
Yes, I've set up packages before so that they work with newer
versions, however in this case the one and only problem is that it requires
'Dsgnintf' after ver 6 of Delphi.  Before that it requires 'designide'.  Is
there a replacement file I can use for this?  Do you have any idea what I
can look for in the Delphi units that might do the job in D2007?


Actually that should be the other way around. DesignIDE was 
instituted in D6 and applies thereafter, I'd have to presume 
D2007 uses it as well.


As long as the main product version .INC file is properly updated 
for Delphi 2007, it should (FLW) address the issue you allude to.



And speaking of D2007, I'm just a little confused about the
currently available versions.  When I purchased D2007, I did so directly
from Borland and received the RAD Pro Studio version 11.0.2627.5503.  But on
the web sites and blogs I see references to D2007 that was released without
Vista compatibility.  Mine has a Vista dialogs component set, yet they speak
of one which doesn't have it included.
Mainly the only reason I want to know about this is to find the
correct updates and/or patches if any have been released.  When I go to the
update site of Borland's, they have 3 patches listed, but I'm not sure if
they are referring to my version or a different one! 


Can't help you there. Sorry.

HTH

Stephen Posey
[EMAIL PROTECTED]
{$I compdefn.inc}
{$ifdef DEL345}
  DsgnIntf
{$else}
  DesignIntf, DesignEditors, VCLEditors, RTLConsts
{$endif}
{
=
file:  compdefn.inc
-- global compiler declarations and settings for SlipKid libraries

==
copyright 2001, 2006 SLiPKid Software
=
}
(**)
(* Delphi Free Stuff Include File.  This file is used for all my components   *)
(* to create some standard defines.  This will help reduce headaches when new *)
(* versions of Delphi and C++Builder are released, among other things.*)
(**)
(* Brad Stowers: [EMAIL PROTECTED]   *)
(* Delphi Free Stuff: http://www.delphifreestuff.com/ *)
(* June 27, 2001  *)
(**)
(* Usage:   Add the following line to the top of your unit file:  *)
(*   {$I DFS.INC} *)
(**)
(**)
(* Complete Boolean Evaluation compiler directive is turned off by including  *)
(*   this file.   *)
(* The $ObjExportAll directive is turned on if compiling with C++Builder 3 or *)
(*   higher.  This is required for Delphi components built in Builder with*)
(*   run-time packages.   *)
(**)
(* Here is a brief explanation of what each of the defines mean:  *)
(* DELPHI_FREE_STUFF: Always defined when DFS.INC is included *)
(* DFS_WIN16: Compilation target is 16-bit Windows*)
(* DFS_WIN32: Compilation target is 32-bit Windows*)
(* DFS_USEDEFSHLOBJ : The SHLOBJ.PAS version contains no none errors. *)
(*Delphi 2.0x and C++Builder 1.0x shipped with a  *)
(*version of SHLOBJ.PAS that had many nasty errors.   *)
(*See my web site in the Hints section for how to fix *)
(* DFS_NO_COM_CLEANUP   : The version of the compiler being used does not *)
(*require COM objects to be released; it is done  *)
(*automatically when they go "out of scope".  *)
(* DFS_NO_DSGNINTF  : Delphi 6 pretty much kills off the DsgnIntf unit*)
(*for good. Split into a couple of new units. *)
(* DFS_DESIGNERSELECTIONS: IDesignerSelections replaced TDesignerSelectionList*)
(* DFS_IPROPERTY: IProperty introduced for design-time stuff. *)
(* DFS_COMPILER_1   : Delphi 1.0 is the compiler.  Note that C++B 1.0 *)
(*does NOT cause this to be defined.  It is really*)
(*the 2.0 compiler.  

Re: D2007 and LockBox

2007-09-16 Thread Stephen Posey
Robert Meek wrote:
>   There used to be a web site on which someone had published new
> packages for the higher Delphi versions since LockBox 2.07 was released as
> open Source.  I have been unable to track this down.  Does anyone know of
> it's still available, and/or how or what I can do to make it install in
> Delphi 2007?

The evidence on the SourceForge site for LockBox 
(sourceforge.net/projects/tplockbox/) is that it's not been 
updated recently enough to have explicit support for D2007.

The typical process we followed at TurboPower to update a product 
for a new version of Delphi was to take the product's version 
include file and add appropriate version defines for the new 
compiler; missing version defines is likely the cause of whatever 
issues you're seeing right now.

We'd then attempt to compile the project and plow through any 
issues that arose due to compiler changes; sometimes that was 
easy, sometimes there was some fiddly work involved.

If I had a copy of D2007, I'd be happy to try to update the 
product for you; but since I don't get it at work any more, and 
can't afford the compiler upgrade on my present salary, I'm kind 
of stuck with D7 for the occasional Delphi stuff I still do.

If you want to take a stab at it yourself, try making the 
compiler define changes and run the compiler. If you let me know 
what sort of error(s) you're seeing, I'll try to diagnose.

Sorry I couldn't be more help.

Stephen Posey
[EMAIL PROTECTED]



___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: MessageDlgPos

2007-07-10 Thread Stephen Posey
Rainer von Saleski wrote:
> According to the Delphi 7 Help file, the syntax for the MessageDlgPos 
> function is
> 
> function MessageDlgPos(const Msg: string; DlgType: TMsgDlgType; Buttons: 
> TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer): Word;
> 
> function MessageDlgPos(const Msg: WideString; DlgType: TMsgDlgType; 
> Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer; DefaultBtn: 
> TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer;
> 
> and the Delphi example for this function is
> 
> MessageDlgPos('Are you there?',mtConfirmation, mbYesNoCancel, 0, 200, 
> 200, mbYes);
> 
> However, the source files seem to have never heard of the DefaultBtn 
> argument.  Worse, if the only two buttons are mbYes and mbNo, the YES 
> button becomes the default (!) -- but there should be no default by 
> default.  Or I have to ask my questions in the negative (Yuk!)
> 
> Does anyone know how to fix this?  Can I simply edit Dialogs.pas and 
> recompile it?  How do I go about doing that?  (Not "how do I fix the 
> source", but what do I compile, and does it need any special installation?)

The second version signature you show is the one from the 
QDialogs.pas unit for CLX applications. If you're getting the 
other signature that implies you're creating a VCL application, 
correct?

Since you're asking about the DefaultBtn parameter, I'm guessing 
what you're after is control over which button is default? If so, 
there's a way to get that effect using the CreateMessageDialog() 
routine in Dialogs.pas.

Before I go into excruciating detail about that, can you say just 
what it is you're after so's I don't waste time and bandwidth on 
something nobody wants?

Regards,

Stephen Posey
[EMAIL PROTECTED]



___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Screen Saver

2007-06-28 Thread Stephen Posey
John Dammeyer wrote:
> Hi,
> 
> Is it possible to enable/disable the windows screen saver from inside a
> Delphi application?

Yes, very easily. Have a look at the SPI_SETSCREENSAVEACTIVE 
option to the SystemParametersInfo() Windows API call.

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Multi select not working as expected in TFileList.

2007-06-19 Thread Stephen Posey
>I want to drag and drop multiple files from a TFileList into a TListBox.
>I set ExtendedSelect and MultiSelect to True, then I select several 
>files (with contol+click or shift+click) then a click a random file in 
>order to start the dragging process. But at this moment all files are 
>deselected (except the last clicked one).
>
>More exactly, clicking the TFileList without having the Shift or Control 
>key pressed will cause to loose the selection.
>This bug hunt's me for a long time but now I really want to drag and 
>drop multiple files.
>
>There is a way to fix the problem or I should consider using a 3rd party 
>control to replace TFileList.

Have you set the TFileList's DragMode property to dmAutomatic?

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: HTML Browser / Parser

2007-04-26 Thread Stephen Posey
-Original Message-
>From: Eddie Shipman <[EMAIL PROTECTED]>
>Sent: Apr 25, 2007 3:05 PM
>To: Borland's Delphi Discussion List 
>Subject: Re: HTML Browser / Parser
>
>I just had to drop in at this time and insert my comments..
>
>HTML can be and in most cases very misused and not very structured.
>Now, if you can make sure that the HTML is structured correctly, then 
>I would think that the MSHTML-DOM would suffice to create your tree.

Absoultely correct, clean well-structured HTML is nearly XML compliant. True 
XHTML (naturally) will be fully so. 

If you can guarantee either (e.g. the source is some kind of code generator 
that you have control over) that greatly simplifies the job. 

A major portion of creating a standard HTML parser meant to handle "live" HTML 
(from the Net) is getting it to respond robustly in the face of all the 
(charitably) idiosyncratic HTML out there in The Wild.

>However, you may also be able to write a recursive function to work
>on the IHTMLDocument2 Object Model. While I have not attempted it, it
>doesn't look like it would be too difficult to do.

I looked into that a bit when I dabbled in writing my own TWebBrowser based 
Browser app a couple of years back. Naked COM interfaces, M (shudder), not 
for the faint of heart. ;-)

Here's a few links to some Delphi stuff on it available on the web:

http://www.cryer.co.uk/brian/delphi/twebbrowser/twebbrowser_oleobject.htm
http://delphi.about.com/od/adptips2004/a/bltip1204_3.htm
http://beensoft.blogspot.com/2006_05_01_archive.html
http://www.delphifaq.com/faq/delphi/network/f241.shtml
http://www.delphipages.com/tips/thread.cfm?ID=292

HTH

Stephen Posey
[EMAIL PROTECTED]


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: HTML Browser / Parser

2007-04-25 Thread Stephen Posey
-Original Message-
>From: Chris Stebbing <[EMAIL PROTECTED]>
>Sent: Apr 23, 2007 9:07 PM
>To: Delphi List 
>Subject: HTML Browser / Parser
>
>Hi All,
>
>this may seem like a strange request, but is there a program out 
>there that will take a web page and break it down into a tree-like 
>structure?  I need to do some web scraping and it would assist me 
>greatly if there was a program which would allow me to traverse the 
>HTML code in a tree-like manner..

The HTML rendering engine we created for TurboPower Internet Professional 
created a linked tree type data structure of the parsed HTML prior to rendering 
it into the HTML display component. I recall manipulating that in order to 
construct the HTTP: engine handling for the FTP sites back in the day.

I can't promise you how gracefully it will handle newer stuff (aspx, cold 
fusion, embedded scripts, etc.) as I don't think it's been touched since we 
made it open source, but it's free and there for the taking:

http://sourceforge.net/projects/tpipro/

HTH

Stephen Posey
[EMAIL PROTECTED]


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Group Boxes & Splitters in the UI

2007-04-19 Thread Stephen Posey
Alan Colburn wrote:
> Hi folks --
> 
> I've got an app with a UI that includes a standard menu and toolbars at the 
> top. The space underneath is divided between two GroupBoxes. There's 
> GroupBox1 aligned to the top (alTop), a Splitter underneath (alTop), and 
> another GroupBox underneath the splitter (alClient). Each group box has 
> various controls contained within.
> Now I'd like to modify the UI and add a panel and splitter to the (left) 
> side of the UI. I'd like the panel to go from the bottom of the toolbar to 
> the bottom of the UI. I don't use Outlook, but I *think* I'm talking about a 
> general interface common to users of Outlook and many e-mail programs.
> 
> In any case, if I add a panel to the UI now it will only span GroupBox1 or 
> GroupBox2. Any idea how to have the panel span the app--other than starting 
> the UI building process over from scratch? (If you set the GroupBox 
> alignments to alNone, add the new panel with its alLeft or alRight 
> alignment, and then change the GroupBox properties back to alTop, you end up 
> with the new panel still only spanning a single group box.)
> 
> As always, thanks in advance for your help. -- Al 

alTop/alBottom take precedence over alRight/alLeft (not sure why 
that should be the case, it's just the way it is, I guess 
something HAD to).

The way to get the effect you want is to add your left hand panel 
and splitter, then add an alClient panel in the remaining area of 
the form.

Then add the alTop GroupBox and Splitter, and alClient GroupBox 
into the alClient panel.

Make sense?

Stephen Posey
[EMAIL PROTECTED]


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: VCL collection management

2007-04-03 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> Dear Rob and Stephen,
> 
> Thanks a lot. It worked.
> 
> I started first with that unit that I added in all my projects years ago.
> Then I started to make my own VCLs, one by one, I added the unit also 
> there and I end up with this big package.
> But today (it took me hours) I cleaned up, splitting everything in small 
> packages.

Sorry about the mis-information regarding putting a unit on the search path 
that Rob pointed out.

I thought I recalled doing that occasionally for TurboPower Run-Time packages 
when there were overlapping units between products; but clearly it's a problem 
for Design-Time packages as the IDE will choke. 

I don't recall how we handled it for redistributable packages, maybe it's just 
failing memory and I've got it all wrong anyway (y'know they say memory is the 
second thing to go, and darned if I can recall what the first thing is... ;-)

Glad to hear you got it working,

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: VCL collection management

2007-03-28 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> Hi.
> 
> I don't like to use 3rd party components (especially for compatibility 
> reasons) so in time I created lost of components for myself.
> The problem is that I am forced to keep them in one single huge package 
> because all of them are using a unit 'PersonalUnit.pas'. As you know, 
> Delphi forces you to compile two packages together if they refer to each 
> other or if they use a common unit.
> Things are even worse: if one component uses a 3rd party VCL then that 
> VCL will also be added to the package.
> 
> I want to know if it is possible to break my huge package in smaller 
> packages but without removing 'PersonalUnit.pas', which I really need it.
> 
> Note: I don't want to redistribute my package and I don't care about 
> portability on other systems.

A couple of approaches:

1. You don't need to actually include PersonalUnit.pas in the package Unit 
list, as long as it's visible on the Package Project's search path it will 
still be available.

2. Multiple packages can depend on the same run-time package, so you could put 
PersonalUnit.pas into its own run-time package and then add that to your other 
packages.

HTH

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Problems with changing captions and text - D6

2007-03-28 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> A few weeks ago I encountered a strange problem which has reared its 
> ugly head again and has left me totally baffled, has anyone else had 
> this problem?
> 
> Initially I had a form (in an application with many forms)with 3 buttons 
> on it, I changed the caption on one of the buttons.  However, after 
> compilation the original caption appeared on the button.  Back in the 
> IDE the new caption was displayed.  Viewing the form as text showed the 
> new caption.  Changing the caption on either of the other two buttons 
> resulted in the new captions showing when running the application.  I 
> also tried moving the offending button to a new position on the form 
> just to check that the modified form was being compiled into the 
> application.  On running the application the button displayed in the new 
> position but with the old caption.  I had other buttons in the 
> application with the same name and same old caption, so I changed the 
> name of the offending button and everything worked great.
> 
> Then last week I changed some design-time text (Lines) in a read-only 
> TMemo.  Same problem.  Again viewing the form as text showed the new 
> text but when running the application the old text appeared.  In this 
> case there was no other TMemo in the application with the same name nor 
> same old text.  The solution was the same as before, I changed the name 
> of the TMemo.
> 
> Now this morning, I've had the same problem again with a button caption.
> 
> Help!  This is driving me mad.

First thing I'd check is that you don't have more than one version of the .dfm 
file for the problematic form hanging around somewhere on the Unit search path. 

That could account for odd persistance of obsolete design time property code 
like this.

Or it could be a corrupted .dfm which can be a very fiddly problem to fix. 

The most straightforward approach, IMO, is to simply recreate the form anew 
which regenerates the .dfm. 

Here's what I do:

1. Create a new blank form
2. Apply any design time properties to the form (size, caption, etc.) to match 
the problem form.
3. On the problem form, select all the components and copy them to the 
clipboard.
4. On the new form, paste the components.
5. In the problem form .pas file, copy the code.
6. Paste the code over the autogenerated code in the new form's .pas file.
7. Close the problem form.
8. Save as... the new form over the problem form.

If those aren't the problem, are you doing anything with custom resources in 
the project?  


Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Delphi dll to return array of integers

2007-03-27 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> Try this: (Compiled successfully but untested)
> 
> type
> TArrayOfInteger = Array of Integer;
> 
> functon createarray(input: Array Of Integer): TArrayOfInteger ;
> 
> You can even replace the internal "Array of Integer" with the type.

You CAN, but that may not be desirable: "array of SomeType"(SomeType being 
Integer in this case) within a parameter signature is an "Open Array Parameter" 
which allows passing of arbitrarily sized and indexed arrays of SomeType to the 
function without typecasting.

With the parameter explicitly typed as TArrayOfInteger, you can only pass other 
TArrayOfIntegers to the function.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Help needed Using TComponentList

2007-03-01 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> Related to this TObjectList/TComponentList discussion,
> can somebody explain the difference between:
> 
> (TObjectList[i] as TSomething)
> and
> TSomething(TObjectList[i])
> 
> Both codes access the same object; one is using the 'as' operator the 
> second one is using a direct typecast. But what are the differences?
> Is one of them faster than the other? Should one of them be used in some 
> cases more than the other?

The difference is the "as" operator invokes Delphi's class management logic and 
actually checks that what you're saying is a TSomething is actually a 
TSomething and throws an exception if it's not, a frequently useful safety net.

By directly typecasting using TSomething() you're insisting to the compiler 
that you know what you're doing and that what you're casting is DEFINITELY a 
TSomething (and if, perchance, it's not a TSomething you may find yourself in 
some deep d**d** when you treat it as such, spectacular crashes are to be 
expected).

Now, you may then ask why not always use "as"? Because the class hierarchy 
checking is expensive in terms of time and processing; wheras direct 
typecasting doesn't incurr that penalty. So, "as" should be used only when 
necessary. 

Just FYI, the "is" operator invokes the same class validation logic as the "as" 
operator, so some common code you see like this is redundant:

  if (MyObject is TSomething) then 
(MyObject as TSomething).Property := SomeValue;

By using "is" like that you've already established that MyObject is a 
TSomething, so it's safe to proceed like so:

  if (MyObject is TSomething) then 
TSomething(MyObject).Property := SomeValue;

HTH

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Help needed Using TComponentList

2007-02-16 Thread Stephen Posey
John Barrat wrote:
> I am writing an application which needs to create a number of components
> (all of the same type - a custom ComboBox).  To manage these I have been
> tryig to use TComponentList but having added these to a TComponentList I
> cannot see how I access there components.
>  
> e.g.
> mCommands := TComponentList.Create;  // create the component list
> // create a new component and add it to the ComponentList.
> mComIdx := mCommands.Add(TMacroCombo.Create(Self, cCommand));
>  
> Now how do I access the properties of the component I have just added? 
>  
> I had assumed I could do something like this
>  
> With mCommands[index] do begin
> align := alLeft;
> ItemIndex := 0;
> etc...
> end
>  
> Have I misunderstood completely on how this class is used?

Probably not, the trick is that ComponentList exposes a 
collection of TComponent references.

So, in order to use them as whatever you actually stored in the 
list instead of just TComponents you have to do some typecasting:

with (mCommands[index] as TMacroCombo) do begin
   align := alLeft;
   ItemIndex := 0;
   etc...
end;

Make sense?

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Visibility and Scope

2006-12-31 Thread Stephen Posey
John Barrat wrote:
> I have a custom control which I have written which itself uses a sub
> components and sub classes which I don't want to expose beyond the
> Component.
>  
> However, there are some aspects of these sub components I need to expose as
> properties in the component.  The problem I have is that some of these
> properties are Enum types which are defined in the subcomponent.  
>  
> How can I get these Enums exposed to the Main application code using the
> component?  I have tried aliaising through the component but this doesn't
> work.  The only way I can get access to these types is by referencing the
> subcomponents in the Uses section of the Main code.
>  
> By way of example:
>  
> I have a component TMultiCom which uses a subcomponent TComPort
> TComPort has a Property of Enum Type BaudRate (comprising br1200, br9600
> etc)  I have a ComSettings property in my TMultiCom control which includes
> the Enum property BaudRate.
>  
> Without adding ComPort to my Uses section of my application how do I make
> this Enum type available to my application?

You can't, the type MUST be visible in order to use it.

Given your description of the situation, my suggestion would be 
to place the enumeration (and any other such declarations) in a 
separate "definitions" unit that your components ("hidden" and 
otherwise) and your application can use.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Browse folder dialogbox, Delphi 7

2006-12-27 Thread Stephen Posey
 Borland's Delphi Discussion List  wrote:
>
> Hello,
> I would like to use in my application a dialog box to browse
> the folders and to retrive a path. The IDE of Delphi 7 shows
> such a box, if you select "Projects/Options/Directories" and
> then you click on the Ellipsis button (...) of Output
> Directory, then a dialog box is shown in which you can
> browse the directories and choose your output directory. I
> would like such a dialog box to reztrieve a path which I can
> use later in my application.
> 
> Is such a component available? The components which are
> offered by the component palette are all more specialized.
> Have I to develope a new component? Which is the best way to
> learn to do this?
 
The Win32 "Browse for Folder" functionality that you're referring is actually 
performed by an API called SHBrowseForFolder().

There are many, many component wrappers for that available on the NET; many of 
them free.

Here's a couple of sites that show how to prepare for and call 
SHBrowseForFolder() directly from Delphi code (it's not particularly 
complicated):

  http://www.cryer.co.uk/brian/delphi/howto_browseforfolder.htm
  http://www.festra.com/eng/snip01.htm

You may not ever want to do that given how many component implementations are 
out there; but it's instructive to see what's actually going on behind the 
scenes.

Beyond that I'd suggest doing a search on Torry's or DSP for "Browse for 
Folder" and/or "SHBrowseForFolder" and you should get plenty of hits.

HTH

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Passing an array

2006-12-26 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> Hi,
> 
>I am writing a routine to manipulate an array of type extended.
> Various other routines will call this routine, and the size of the
> array to be passed will vary.
>How can I pass an array to this routine?  Something like, pass the
> size of the array and the location of the first value, so the
> routine's calling sequence would be something like (var N : integer;
> var Arr : ???).
>I want to be able to call it with, for example, an array defined in
> the calling program as "var Arr1 : array[1..100] of extended" and also
> later with an array defined as "var Arr2: array[1..750] of extended".
> How do I define the routine so that it can accept and work with an
> array of any size?

The Delphi dialect of Pascal is actually very smart about passing arrays of 
varying sizes, all you need to do is to use an "open array parameter" like so:

var A: array of Extended

Within the routine you can determine the upper and lower indicies of the passed 
array using the System High() and Low() routines.

As a brain-dead but mildly useful example, the following will take an arbitrary 
array of Extended and set each element to a passed in value (good for clearing 
the array):

procedure BumpExtended(var A: array of Extended; V: Extended);
var
  i: Integer;
begin  
  for i := Low(A) to High(A) do 
A[i] := V;
end;

HTH

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: SV: Drag and drop from a camera connected to USB port

2006-11-21 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> The camera does not require any extra software in XP to operate.
> As soon as you connect the camera to the USB port, Xp detects it as
> a digital camera and adds an icon in explorer, but it does not map 
> the camera to a drive letter.

Really? That seems very odd to me. 

What category does it appear under in "My Computer"?

Stephen Posey
[EMAIL PROTECTED]


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Drag and drop from a camera connected to USB port

2006-11-21 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> Hello
>  
> I have a small problem
> I'm using D.Melanders drag & drop components (v.4.0) in one of my
> applications.
> I want to drag and drop pictures straight from a Canon Powershot S80
> into my application, but the drag and drop components does not support
> drag and drop from a USB device (must be a drive letter).
> Does anybody know how to do this in code ?
> I'm using Delphi 5 Enterprise.
> The reason for the need to drag the pictures into my app is that my
> users
> allways use max resolution on the camera, but I want to resize all
> pics to 1600x1200 and compress them a little bit before sending the
> pictures to the archive. 
> This works perfect in my app from Explorer if you have the pictures on a
> local disk or a network drive,
> but not straight from the camera.

Hmmm, my experience with digital USB cameras is that they all map their image 
storage as a removeable drive when you link them to the PC. 

I suspect if you check Explorer or My Computer after hooking up the camera 
you'll see there's a drive letter mapped that represents the camera's image 
storage.

Now, the particular camera you're using may have installed its own proprietary 
viewing software that it registers to be brought up when the camera is 
attached; and that software may well NOT support shell drag and drop (can you 
drag and drop images from it into an Explorer folder?). 

If that's the case and you can't get your users to skip the software and use 
the mapped drive in Explorer instead, there's not much to be done about it 
except complain to the software writers and ask them to add drag and drop. 

Or perhaps you could replace or supplement the registered viewer application 
with your own that references the camera's storage? That way the user wouldn't 
even have to bother with drag and drop; your app could serve as a direct 
interface onto the images.

HTH

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: It will .Net eat other languages?

2006-11-09 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> > Is time for me to drop Delphi and start learning that .Net stuff?
> 
> You can write .net application using Delphi today !
> You don't need to abandon Delphi to write .NET applications. Just continue
> to use Delphi !

Anyone thinking of switching from Delphi just to get to .NET might want to read 
this blog:

  http://randymagruder.blogspot.com/

Look at the section "Why the developer elites are wrong...".  Other entries are 
interesting too, but this one is particularly relevant to the "Delphi vs. .NET" 
question.

Also, Evans Data Corporation has recently released the results of their 
"Developers Choice-IDE Studies"; a comparative survey of the major development 
IDEs.

Out of 11 major devlopment IDEs or environments they inquired about, Delphi won 
or placed in several categories, including: 

* Compiler / Interpreter (1st Place)
* Debugger (1st Place)
* Editor (3rd Place)
* Make/Build Function (2nd Place)
* Compiler Performance (1st Place)
* Performance of Resulting Applications (1st Place)
* Ease of use (1st Place)
* Ability to Integrate Third Party Tools (3rd Place)
* Availability of Third Party Tools (2nd Place)

You can get a free "Score Card" synopsis of the results and order the full 
version for $79.95 (hmmm) here:

  http://evansdata.com/devchoice_ide_scorecard.php?s=edc

I actually got a free copy because I participated in the survey. I'll forward 
it to anyone who's REALLY interested, especially if you think it might 
influence someone's opinions about using Delphi.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: about BRCC32, RC and RES files

2006-10-03 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> 
> Thank you very much for this detailed answer.
> It looks like you worked allot with RC files before.
> 
> I really didn't know that Delphi can handle directly RC files.

It couldn't always; I think the built-in ability to handle .RC files came in 
with version 6 or 7. 

Before that any resources other than the few the compiler handled automatically 
(the main icon, string tables via the "resourcestring" mechanism, and version 
resources) had to be pre-compiled into .RES files first; for which I typically 
used Resource Workshop.

> The icons were separated but now, after your answer, I will put the 
> common icons in a single icon file.
> Can you recommend a good icon editor software because until now I fond 
> only rudimentary programs. I don't care the price is it is under 150$. 
> My Paint Shop Pro 10 can't handle icon files :(

I like Axialis' Icon Workshop:

http://www.axialis.com/

The interface is maybe a little bit "over the top" glitzy, but I can't fault 
the functionality, there's been nothing I wanted to do with an icon recently 
that I couldn't do with this tool; e.g.: icon sizes ranging from 16x16 to 
128x128 (and custom sizes), a full range of color depths, handles alpha channel 
transparency effects easily, handles multiple icons in a single .ico file, 
sophisticated import/export capabilities, handles most icon library formats; 
and it's considerably less than $150.

HTH

Stephen Posey
[EMAIL PROTECTED] 
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: How to Monitoring File Under XP

2006-09-19 Thread Stephen Posey

 Borland's Delphi Discussion List  wrote:
>
> I've made a small program to monitoring Directory change.
> I'm using GetCurrentDir Function but it doesn't work.
> I can't reach the directory that Windows Explorer Opened.
> 
> Does eny one know how to monitoring is a file/Folder open, read, 
> deleted or renamed ?
> 
> Thank's Before

If I understand what it is you want to do, you're looking for "shell change 
notifications". Here's some links describing them:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/Functions/SHChangeNotifyRegister.asp

http://www.geocities.com/siliconvalley/4942/notify.html

http://delphi.about.com/library/code/ncaa030403b.htm

http://www.howtodothings.com/computers/a1154-getting-notifications-from-the-shell.html

HTH

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Delphi SysTools for PDF417 barcode creation

2006-09-11 Thread Stephen Posey
Neil Beshoori wrote:
> I have been struggling with a problem with the numeric encoding function 
> which will generate a Range Error
> with strings longer than say 35.
> 
> Does anyone here know if a fix is available or has found this 'bug'.
> 
> I believe the problem is in the following procedure
> procedure TStPDF417Barcode.EncodeNumeric
> 
> Any help would be most appreciated

Can't provide you an immediate fix, but I can sure have a look at 
it.

I worked on the BarCode units when I was at TurboPower so I 
should be able to give a hand.

Can you provide me with a stripped down test case shows the problem?

Regards,

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Scrollbars in TMemo when Enabled=False

2006-08-15 Thread Stephen Posey
Rich Cooper wrote:
> Hi All,
> 
> Using D7 and Indy 9, I have some data fields that are extracted
> from web pages, so they can be arbitrarily long.  I want to use 
> TMemos with ssBoth scrollbars so people can see the entire field.
> First, I used TLabels to display the fields, but the fields extended
> past the limits of my TPanel which holds the TLabels, so I went to
> TMemos with scrollbars to get around this problem.  
> 
> But I don't want the user to be able to change the text in the TMemo
> any more than s/he would with the TLabel.  So I set Enabled=False
> in the TMemo fields.
> 
> Problem is, when the TMemo has lots of text, the user can't operate
> the scrollbars when Enabled=False.  So s/he can't see the material
> in the TMemo which is off the visual area.  
> 
> I would like to present the entire text to a user, letting the user 
> manage the scrollbar positions, but not let the user change the text.
> 
> Does anyone know how to do this?

Try the ReadOnly property rather than the Enabled property.

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Declaration of types/constants within the class interface

2006-08-03 Thread Stephen Posey
Sean ROBINS wrote:
> It seems that since Delphi2005 was released, you can declare constants
> and types within the body of a class's interface declaration. 
> 
> For example:
> 
> unit MyUnit;
> 
> interface
> 
> type
> TMyClass = class(TObject)
> public
> const
> A_LITTLE_CONSTANT = 5;
> type
> TMyInternalEnum = (aFirstItem, aSecondItem, aThirdItem);
> 
> 
> 
> end;
> 
> implementation
> 
> ...
> 
> end;
> 
> 
> 
> The question is, why would you want to use this style of declaration,
> and what are the benefits/pitfalls of doing so? 

That's cool, I'm glad to hear that's been done.

I suspect this syntax represents the Delphi support for certain .NET 
language features that was implemented for Delphi.NET and back-formed 
onto the language as a whole.

Benefits:
It extends the data hiding aspects of class declarations to associated 
types and constants, increasing abstraction and encapsulation.

It provides additional layers of "namespace" scoping for such items.

Pitfalls:
There's clearly some potential for confusion as this is a fairly big 
departure from traditional Pascal/Delphi declaration syntax.

Question:
Are such declarations treated as "static" class properties? I.e. can 
they be accessed via the class name alone, or is an instance required?

For example, can I say?:

var
   X: Integer;
   EnumVar: TMyClass.TMyInternalEnum;
begin
   X := TMyClass.A_LITTLE_CONSTANT;
   EnumVar := TMyClass.aFirstItem;

??
I would suspect/hope so; that would be the most parallel with the .NET 
syntax I presume this is intended to implement.

Of course, if such members are declared private or protected, the 
scoping rules for that should come into play.

I don't have D200x or I'd check for myself. :-/

Stephen Posey
[EMAIL PROTECTED]


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Telnet, Indy9, text file conversion;

2006-08-03 Thread Stephen Posey
Mick Arundell wrote:
>> Date: Tue, 01 Aug 2006 11:22:37 -0600
>> From: Stephen Posey <[EMAIL PROTECTED]>
>> Subject: Re: Telnet, Indy9, text file conversion;
>> To: Borland's Delphi Discussion List 
>> Message-ID: <[EMAIL PROTECTED]>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> [EMAIL PROTECTED] wrote:
>> 
>>
>>> Yes you can use your telnet component to retrieve a string.
>>> Standard pascal read routine will read comma separated
>>> fields
>> I'm not aware of how to do that with the Read() or ReadLn() routines
>> (which is what I presume you mean); at least not without reading an
>> entire line as a string and then parsing.
>>
>> Can you clarify?
>>
>> Stephen Posey
>> [EMAIL PROTECTED]
>>
> 
> Hi Stephen
> It goes like
>   OpenFile(handle)
> 
> read(File, Var1, Var2, Var3...);
> fairly sure it goes like that but out of practice.

To use Read() like that, Standard Pascal (and AFAIK Delphi) expects data 
values separated by white space (Space characters, and maybe Tab 
characters, haven't tried that).

Commas are interpreted as extraneous character data that prevents 
reading the values as-is.

So, expanding your example a little, some code like:

var
   Var1, Var2, Var3: Integer;
   F: TextFile; // "File" is a reserved word in Pascal
begin
   AssignFile(File, 'test.txt');
   Reset(File);
   ReadLn(File, Var1, Var2, Var3);

will work with lines like:

10 20 30
100 1000 1

but will choke on:

10,20,30
100, 1000, 1

Now, many dialects of BASIC include a facility to read comma delimited 
input using the INPUT command, which may be what you're recalling.

> For me I'd readln then parse myself - more control and more control I could
> get like BillG :)
> 
> Not sure if you can cast a memorystream as a filestream
> be nice if you could

TMemoryStream has LoadFromFile/SaveToFile methods which achieves a lot 
of the same thing.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Telnet, Indy9, text file conversion;

2006-08-01 Thread Stephen Posey
[EMAIL PROTECTED] wrote:


> Yes you can use your telnet component to retrieve a string.
> Standard pascal read routine will read comma separated
> fields

I'm not aware of how to do that with the Read() or ReadLn() routines 
(which is what I presume you mean); at least not without reading an 
entire line as a string and then parsing.

Can you clarify?

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Telnet, Indy9, text file conversion; (Jerry Mallett)

2006-07-31 Thread Stephen Posey
Jerry Mallett wrote:
> Just had confirmation on this file format.  30 Fields in total and all are 
> output regardless of content.
> I had thought that each record started with the date and time of call but 
> that info appears twice in
> the record so I've seperated the records for clarity.
> 
> 27/07/2006 12:15,Catherine Bradley,Modules.CallServer 00
> -07-d9-00-1c-6b.PRI,Catherine Bradley,2180,,,07813922167,63390,26830,,,1,,,
> Catherine Bradley,d40d0300-e4a6-c814-927e-0007d9001fc7,0,,10,30890,20970,
> 27/07/2006 11:15:46.513,,1,Catherine Bradley,,,0,
> 
> 27/07/2006 12:16,Cheryl Rainey,Modules.CallServer 
> 00-07-d9-00-1c-6b.PRI,Cheryl R
> ainey,2022,,,00353749156837,36620,14250,,,1,,,Cheryl 
> Rainey,d4200a00-4ca5-c814-b
> 868-0007d90019a1,0,,10,20250,16170,
> 27/07/2006 11:16:06.274,,1,Cheryl Rainey,,,0,
> 
> 27/07/2006 12:16,McCambridge Duffy Customer Care one,,,07775911808,Theresa 
> Gilli
> spie,McCambridge Duffy Customer Care 
> one,8001,115180,112730,,,1,Modules.CallServ
> er 00-07-d9-00-1c-6b.PRI,2000,McCambridge Duffy Customer Care 
> one,47f50700-04a0-
> c814-b011-0007d9001c6b,0,6c350d00-6aa1-c814-8770-0007d9001aa2,110,2340,2240,
> 27/07/2006 11:16:07.735,,1,McCambridge Duffy Customer Care one,,,0,
> 
> 27/07/2006 12:16,Theresa Gillispie,,Theresa Gillispie,2000,Danielle mc 
> conway,Da
> nielle mc conway,2168,42580,24620,,,1,,2168,Theresa 
> Gillispie,6c350d00-6aa1-c814
> -8770-0007d9001aa2,1,47f50700-04a0-c814-b011-0007d9001c6b,0,3220,3190,27/07/2006
>  11:16:07.736,,1,Theresa Gillispie,,,0,,
> 
> It has been suggested that this is a CSV file but my limited knowledge tells 
> me it's not a true CSV.
> Shouldn't text fields be enclosed in quote "" marks?  

Not strictly necessary if you have a guarantee that a comma may not 
otherwise appear within a field.

> Shouldn't the format 
> be one line per record and not spread over numerous lines?

Also not particularly necessary; Internet text file formats are 
historically line-terminator "neutral".

If you're using code that expects lines, you'll probably have to parse 
out the embedded breaks and reformat first.

> What is the best way of reading in this file one record at a time.( Would
> really like to know how to properly read in and manipulate text files.  See 
> plenty of tutorials on more
> advance subjects but never any to deal with the common text file.)

You can try the TStrings CommaText property, which unfortunately has 
some non-standard behaviors.

For some more sophisticated handling, I'd suggest you have a look at the 
delimited text classes in TurboPower's SysTools; which are (of course) 
now open source and available on SourceForge.

> Also,  I was wondering, could I use a Telnet component in my Delphi App. to
> directly access the 4001 port and pull the data directly into my database.

Could be, I have no experience with that.

HTH

Stephen Posey
[EMAIL PROTECTED]




This message and its attachments are for the sole use of the intended 
recipient(s) and may contain confidential, 
 proprietary and privileged information. Any unauthorized review, copying, use, 
disclosure or distribution is prohibited. If 
 you are not the intended recipient, please notify the sender immediately by 
replying to the address listed in the From: 
 field and destroy all copies of the original message and its attachments.
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Polygon with variable array

2006-07-27 Thread Stephen Posey
Whitehat wrote:
> Yes I'm using Canvas.Polygon(Points).
> I set
> var
>   Points:array[0..99] of TPoint;
> Now if my procedure call is to use say only the first 20 points it goes
> ahead and uses the rest of the points as well. If there was data there
> from a previous call, what a mess. So, as I said, to get around it,  I
> just filled in the remainder of the points with the values for the last
> point.
> It works.
> I tried using an open array but it would not compile.

Something like the following works fine for me, what are you doing 
differently?

procedure TForm1.Button1Click(Sender: TObject);
var
   A: array of TPoint;
begin
   SetLength(A, 6);

   // draw a pentagon
   A[0].X := ClientWidth div 2; A[0].Y := 10;
   A[1].X := ClientWidth div 2; A[1].Y := 10;
   A[2].X := ClientWidth div 2 + 50 ; A[2].Y := 50;
   A[3].X := ClientWidth div 2 + 30; A[3].Y := 100;
   A[4].X := ClientWidth div 2 - 30; A[4].Y := 100;
   A[5].X := ClientWidth div 2 - 50; A[5].Y := 50;

   Canvas.Pen.Color := clRed;
   Canvas.Pen.Width := 3;
   Canvas.Polygon(A);
end;


Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Polygon with variable array

2006-07-26 Thread Stephen Posey
Whitehat wrote:
> I solved it by setting the array size to the maximum size I would need.
> Then after loading in the needed points I set all the points beyond that
> to the last needed point. It's not very elegant but it works.
> 
>> Whitehat wrote:
>>> I want to draw a polygon using an array of points. The size of the
>>> array can vary from 10 to 100. How do I get the Polygon procedure to
>>> work with a variable size array?

By the "Polygon" procedure, I'm assuming you mean TCanvas.Polygon?

If so, a dynamic array ought to just work, what sort of trouble are you 
having?

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Shortcuts in Memo Boxes

2006-07-20 Thread Stephen Posey
Alan Colburn wrote:
> Just a quick follow-up. I used the code line below to trap the CTL-SHIFT-S 
> combo and, somehow, everything seems to be working fine now. I don't 
> understand what's different. Perhaps the moon changed its phases :-)
> 
> As a side point, I also tried setting the method up as an Action, although 
> it doesn't look like CTL-SHIFT-S is one of the shortcut keystrokes available 
> (...not that there aren't plenty of others from which to choose).

Just because a keystroke sequence doesn't appear in the ShortCut 
property drop-down, don't assume it's not a valid shortcut.

The drop down only shows a limited list of the more common keystrokes, 
you can type in others that also work, try typing in "CTRL+SHIFT+S" 
(note the '+' signs) and watch what happens.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Shortcuts in Memo Boxes

2006-07-18 Thread Stephen Posey
Alan Colburn wrote:
> I've got a Memo box and what I'm trying to do is have users be able
> to highlight some text within the memo, press CTRL+SHIFT+S, and then
> do something with the highlighted text. I've got two quick questions
> related to this. First, how does one capture the CTRL-SHIFT-S
> keystroke combination in something like a KeyDown or KeyUp event?

You CAN use the "OnKey*" events for this, trapping a complex keystroke 
looks something like:

procedure TForm1.Memo1Keydown(Sender: TObject;
   var Key: Word; Shift: TShiftState);
begin
   if (Key = Ord('S')) and (Shift = [ssCTRL, ssShift]) then...
end;

But as another poster pointed out, it's much easier to work with Actions.

> For now I've simply been using the Escape key as a substitute. So, if
> ESC is pressed then a begin/end block that works with Memo.SelText
> executes. After the block executes (and the event handler ends), the
> Memo is cleared ... any text that was previously in it, whether
> highlighted or not, goes away. Although I'm not including the method,
> I can step through the code and see that the memo's text is *not*
> cleared because of any sub-routines that I've added.
>
> Do you know why the memo is cleared? And, more importantly, the
> alternate line(s) I should write to simply work with the selected
> text and then return the focus back to the otherwise untouched Memo?

If you're 100% sure you're not setting SelText somewhere then my first 
guess is that something is "typing" into the Memo, which serves to clear 
the selected text.

Post your current key handling code, it will probably show up there.

Stephen Posey
[EMAIL PROTECTED]




This message and its attachments are for the sole use of the intended 
recipient(s) and may contain confidential, 
 proprietary and privileged information. Any unauthorized review, copying, use, 
disclosure or distribution is prohibited. If 
 you are not the intended recipient, please notify the sender immediately by 
replying to the address listed in the From: 
 field and destroy all copies of the original message and its attachments.
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: similiar to opening a csv file in default program

2006-07-10 Thread Stephen Posey
Rich Cooper wrote:

>>> Does anyone have a way to determine whether the file HARBOR.TXT
>>> has been released for reading after being completely written?  I would
>>> be able to fix this problem by replacing the Sleep(500) with a loop
>>> that tests till the HARBOR.TXT file is ready for reading, having been
>>> fully released.

>> I don't know precisely how cmd.exe creates and opens a redirected file
>> like that, but your attempting to open it in "exclusive share" mode
>> ought to fail regardless if the file is still being written.
>>
>> You can use a TFileStream instance, like so:
>>
>>   FS := TFileStream.Create(D + 'HARBOR.TXT',
>>fmOpenRead or fmShareExclusive);
>>
>> Attempt that and catch any exception raised due to the sharing conflict
>> (should be some form of EInOutError), if the file exists and no
>> exception is raised on attempting to open it, then it should be finished.
>>
>> HTH
>>
>> Stephen Posey
>> [EMAIL PROTECTED]
> 
> I tried "LoadFromFile()" with try ... except end around it and kept
> looping till the exceptions went away - that worked just fine!
> 
> Thanks Stephen and Simon,

Glad you got it working.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: similiar to opening a csv file in default program

2006-07-07 Thread Stephen Posey
Rich Cooper wrote:
> Thanks Stephen,
> 
> I found a web page with a similar snippet, and so I was able to
> get the following to work in my OnFormCreate handler:
> 
> 
>   D := GetStartDir;
>   ShellExecute( 0, 'open', PChar('command.com'),
> PChar('/c '+'ipconfig/all > harbor.txt'),
> nil, SW_HIDE );
>   Waiting := 100;
>   while ( (Waiting>0) and (not FileExists(D+'HARBOR.TXT')))
>   do begin
> Sleep(250);
> Waiting := Waiting-1;
>  end;
> 
>   if   (not FileExists(D+'HARBOR.TXT'))
>   then raise Exception.Create('Login Error 1.');
> 
> But there is still a problem.  The 'Waiting' loop discovers that the
> file exists, but not whether it has been completely written and let
> loose to be read.  In my OnFormActivate handler, I use:
> 
>if   FirstActivation
>then begin
>   D := GetStartDir;
>   Application.ProcessMessages;
>   Sleep(500);
> 
>   if   FileExists(D+'HARBOR.TXT')
>   then begin
>   meHarbor.Lines.LoadFromFile(D+'HARBOR.TXT');
> 
> 
> which works 95% of the time.  But sometimes it causes the LoadFromFile
> procedure to throw an exception related to trying to read a file that is
> not yet ready to be read - still locked by the NT file system in XP, and not
> yet completely written to the HARBOR.TXT file and then released to
> the rest of the computer.
> 
> Does anyone have a way to determine whether the file HARBOR.TXT
> has been released for reading after being completely written?  I would
> be able to fix this problem by replacing the Sleep(500) with a loop
> that tests till the HARBOR.TXT file is ready for reading, having been
> fully released.

I don't know precisely how cmd.exe creates and opens a redirected file 
like that, but your attempting to open it in "exclusive share" mode 
ought to fail regardless if the file is still being written.

You can use a TFileStream instance, like so:

   FS := TFileStream.Create(D + 'HARBOR.TXT',
fmOpenRead or fmShareExclusive);

Attempt that and catch any exception raised due to the sharing conflict 
(should be some form of EInOutError), if the file exists and no 
exception is raised on attempting to open it, then it should be finished.

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Font problem

2006-07-06 Thread Stephen Posey
Colin Lehmann wrote:
> I want to read from a text file into a Tstringlist and later write it to 
> a TStatusbar, the problem is that the text is Thai.
> I can write the text file OK using EditPad with the Thai font which is 
> installed on the computer selected but when I read it in to my 
> stringlist and write it to the Statusbar all I get is a row of '?'.
> I have the font on the TStatusbar set correctly and everything else 
> seems to work OK.
> 
> Can anyone help?

What have you set for the StatusBar.Font.Charset property?

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: similiar to opening a csv file in default program

2006-07-06 Thread Stephen Posey
Rich Cooper wrote:
> I'm trying to pipe a DOS command to a file using a ShellExecute,
> but it doesn't create  the output file.  Here's the code:
> 
> var D : string;
> ...
>   D := GetStartDir;
>   ShellExecute(0,pChar('ipconfig/all > 
> '),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL);
> ...
> 
> but no file named 'harbor.txt' gets created.  Does anyone know how to
> fix this?

The issue with "piping" is that it's a function of the "DOS" command 
processor (CMD.EXE under NT/Win2000/XP); ShellExecute on its own knows 
nothing of it.

In order to accomplish what you're describing you'll need to invoke the 
command processor to run the command. Something like:

   ShellExecute(0,
 pchar('OPEN'),
 pchar('c:\windows\system32\cmd.exe'),
 pchar(' /c c:\windows\system32\ipconfig.exe /all > c:\harbor.txt'),
 pchar('c:\'),
 SW_SHOWNORMAL);

ought to do it.

HTH

Stephen Posey
[EMAIL PROTECTED]




This message and its attachments are for the sole use of the intended 
recipient(s) and may contain confidential, 
 proprietary and privileged information. Any unauthorized review, copying, use, 
disclosure or distribution is prohibited. If 
 you are not the intended recipient, please notify the sender immediately by 
replying to the address listed in the From: 
 field and destroy all copies of the original message and its attachments.
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Getting Tmemo info

2006-07-01 Thread Stephen Posey
Robert Meek wrote:
>   When using a TRichedit I've also used the following code to get the
> Line and column so they can be displayed in the StatusBar.  I'd like to do
> the same for a TMemo, but EM_EXLINEFROMCHAR requires Richedit in the uses
> clause and it's seems like overkill to have to include it just for this one
> message.  Is there a comparable way of handling this for a TMemo?
> 
> procedure TEditFrA.UpdateCursorPos(Sender: TObject);
> var
>   CharPos: TPoint;
> begin
>   CharPos.Y := SendMessage(FrMemo.Handle, EM_EXLINEFROMCHAR, 0,
> FrMemo.SelStart);
>   CharPos.X := (FrMemo.SelStart -
> SendMessage(FrMemo.Handle, EM_LINEINDEX, CharPos.Y, 0));
>   Inc(CharPos.Y);
>   Inc(CharPos.X);
>   Editor.LineColStatPane.Caption := InttoStr(CharPos.Y) + '/' +
> InttoStr(CharPos.X);
> end;

You should get the same result using just EM_LINEFROMCHAR for a TMemo.

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Application won't run under WIN-ZP

2006-06-16 Thread Stephen Posey
John Dammeyer wrote:
> Hi all,
> 
> I have an application that originally ran under WIN-98 and runs on my WIN-XP
> PRO system and also my WIN-XP laptop.  But both of those also have Delphi-5
> installed.  When I move the app over to a WIN-XP system and that doesn't
> have Delphi and try and run it the disk chatters for a moment and then
> nothing.  Task manager briefly shows something is running but it's there and
> gone too quickly to see.
> 
> So I'm guessing that I'm missing a fairly standard system DLL that isn't on
> my install list.  Is there some sort of writeup or method of determining
> which DLLs a Delphi app needs?

First guess: Did you perhaps build with Runtime Packages enabled? (Look 
under "Project>Options>Packages" there's a "Build with Runtime Packages" 
checkbox near the bottom of the tab).

Having this turned on means you must distribute any packages listed in 
the edit box just above with your App in order for it to work.

Normally missing packages result in a pretty recognizable error message, 
but I can imagine something like you describe resulting depending on 
several factors.

HTH

Stephen Posey
[EMAIL PROTECTED]



This message and its attachments are for the sole use of the intended 
recipient(s) and may contain confidential, 
 proprietary and privileged information. Any unauthorized review, copying, use, 
disclosure or distribution is prohibited. If 
 you are not the intended recipient, please notify the sender immediately by 
replying to the address listed in the From: 
 field and destroy all copies of the original message and its attachments.
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Return to top of memo field

2006-05-05 Thread Stephen Posey
[EMAIL PROTECTED] wrote:
> Hopefully this will be a quick answer to a question that's been baffling 
> me for a while
> 
> I'm writing output to a log file and using a standard TMemo component.
> In my main processing, I add lines to the Memo as normal 
> Memo1.Lines.Add('some text');
> I have approx. 100 lines in the Memo, and a vertical scrollbar, but when I 
> have finished adding lines to the Memo, I need to return to the 1st line 
> in the Memo rather than getting the User to scroll up to the beginning 
> themselves.
> I've looked at all the properties of TMemo, and can't find one to do this 
> - can anyone help?
> Ideally would like a Memo1.ReturnToTop property! 

Setting the SelStart property to 0 should do it.

However, I can't recall off the top of my head whether or not setting 
the SelStart property also scrolls the memo's display to keep the caret 
visible.

If not then setting SelStart to 0 and THEN sending the EM_SCROLLCARET 
message thusly:

   Memo1.Perform(EM_SCROLLCARET, 0, 0);

should definitely do it.

HTH

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: RichEdit scrolling

2006-04-25 Thread Stephen Posey
Peter KAPAS wrote:

> Hi All,
> 
> I have a problem. I use RichEdit in my program and I use FindText function 
> with SelStart property. I don't see how to show that part of the text from 
> RichEdit window where the cursor is jumping. It is not rolling automatically 
> to show the highlighted text. How to force the program to roll the text that 
> I can see the highlighted part on the visible window?

Something like:

   MyRichEdit.Perform(EM_SCROLLCARET, 0, 0);

ought to do the trick.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Interface use question

2006-03-22 Thread Stephen Posey
Robert Meek wrote:
>   When you have an application that runs from the tray, do you prefer
> NOT to have it also show up on the windows taskbar, or do you like it to
> appear in both?  I've tried to make this an optional setting however it
> doesn't seem possible as the mainform is created one way or the other before
> option settings can be read...unless someone knows of a way to handle this
> directly from the dpr?  And note, the mainform of my application is used
> only for basic setup code, global interface control components, the trayicon
> component, and its custom popup menu code...it never actually becomes
> visible nor is it accessed directly in anyway by the user!  

When I was at TurboPower we struggled with precisely this question in 
desgining the "Tray Icon" component for SysTools (the component was 
later shifted to the ShellShock product).

Some folks wanted it one way, some the other and it was not a clear win 
for either side, so we elected to make it optional.

I don't recall precisely how we did it (I'd have to dig out the 
StTrIcon.pas code to review), but it's possible.

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Formatting Text Files

2006-03-21 Thread Stephen Posey
Gordon Waters wrote:

> Hi Delphi Fans,
> 
> I am trying to format a series of text files and combined them in to one 
> large file.
> 
> My issue is that my input text files are generated by an external 
> system, and this is putting 4 blank lines through out  the text file, 
> what I am trying to do is to remove these 4 blank lines.(and only the 4 
> blank lines) from the files.
> 
> I am currently reading the input files from disk, and appending them to 
> a memo, I then save this memo back to disk with a new name.
> 
> So what I am asking is what is a easy way to detect 4 x CR LF in a row 
> and skip appending these to my memo.

You could load the entire file into a string and then scan it for the 4 
CRLF sequences in a row.

I'd suggest using something other than Delphi's built-in Pos() routine 
though; it's dreadfully slow for this kind of thing.

There's lots of Pascal/Delphi implementations of good string searches 
(e.g. Boyer-Moore) available on the Net.

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Changing RadioGroup items ... faster

2006-02-28 Thread Stephen Posey
Alan Colburn wrote:
> I've got a form with a bunch of RadioGroups. I created an array of 
> RadioGroups to make it easier to write code to work with the group. I've 
> also got a ComboBox in which the user can choose whether s/he would like to 
> display 2, 3, or 4 items (i.e., select "2" and all the RadioGroups will have 
> 2 and 1 as their items; select "3" and they'll all display 3, 2, and 1).
> 
> The ComboBox OnChange event begins by clearing all the RadioGroups, and then 
> adding items back (with the items added depending upon what the user 
> selected in the ComboBox):
> 
> for i := 1 to 19 do
>   begin
> gRadioArray[i].Items.Clear;
> with cbxPerformanceLevels do
>   //add items here, depending on what user selected
>   end;
> 
> The code works fine, and it's simple. The problem is that it's slow. On my 
> machine I can watch each RadioGroup be cleared, one at a time, before items 
> are added in.
> 
> Do you have any ideas about a faster way to do this?

I'd suggest using RadioGroup.Items.BeginUpdate and 
RadioGroup.Items.EndUpdate around your loop to prevent the group 
repainting itself each time you add or remove an item.

You might also try building your list of new items in a TStringList in 
memory and then add it all at once to the RadioGroup using

   RadioGroup.Items.Assign(StringList);

HTH

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: PDF417 bar code

2006-02-17 Thread Stephen Posey
Cosmin Prund wrote:

> Hello everyone!
> 
> Anyone knows a good library that would allow me to generate PDF417 bar
> codes? Google generates lots of results on this subject but most libraries
> are ActiveX based and deploying an ActiveX for the simple matter of
> generating a barcode is too much.

TurboPower's Systools product (now available as Open Source on 
SourceForge) has a pure Delphi code implementation of PDF417.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: D2006 and TabStops

2006-02-02 Thread Stephen Posey
Rob Kennedy wrote:


> By the way, "it's" is a contraction for "it is." The possessive form of 
> "it" is "its." (It goes with the all other possessive pronouns, which 
> also lack apostrophes: his, hers, ours, theirs, yours, mine.)

Thanks for that. The its/it's distinction is one of my pet bugaboos in 
writen text, but I always feel like a insufferable pedant when I point 
it out to folks.

Stephen Posey
[EMAIL PROTECTED]




___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Truncate

2006-01-25 Thread Stephen Posey
Ross Levis wrote:
> Further to this problem, I discovered it has nothing to do with 
> operating systems or Delphi versions.
> 
> I discovered that the hex editor I was looking at the file with was 
> preventing the file from being truncated by my app.  I'm guessing the 
> editor is opening the file in a shared read/write mode and even though 
> my app can open the file in readwrite mode, it cannot truncate it if 
> it's open by the editor.  That is rather dangerous in my situation and I 
> would rather not be able to open the file except in readonly mode in 
> this situation.
> 
> Is there a simple way to check if the file is open by another app in 
> readwrite or write mode?  I don't need to know if the file is open in 
> read mode by another app as this appears to work fine when truncating.

The only way I know to do this is to attempt to open the file with 
fmShareDenyWrite. If another process already has the file open with 
Write capability, the open attempt should fail with a file I/O exception.

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Restrict MDI Child display zone

2005-12-28 Thread Stephen Posey
SF wrote:
> Rob Kennedy wrote:
> 
> 
>>SF wrote:
>> 
>>
>>
>>>I was used to use AlTop alignement of panels in the main form and the 
>>>zone is well restricted. But i would like to use custom alignement. But 
>>>doing that, the MDI Child are displayed behind the alCustom aligned 
>>>panels(or frames). Do you have an idea on how to restrict the zone ?
>>>   
>>>
>>
>>Put one big panel aligned to the top, and then align all your other 
>>panels inside of it.
>>
>> 
>>
> 
> Thanks for your help.
> But i have also a Left Aligned Panel.
> If i let Delphi align priorities the result is :
> 
> 
> 
> 
> |  MyFrame |
> |--|
> |  |   |
> |  |  mdi  |
> |  | child |
> |  | zone  |
> |  |   |
> 
> 
> And what i would like is :
> 
> 
> 
> |  |   |
> |  |---|
> |  |   |
> |  |  mdi  |
> |  | child |
> |  | zone  |
> |  |   |
> 
> 
> In order to do that i am acutally overriding AlignControls method of the 
> main form :
> 
> //**
> // Align Controls After Display in order to adjust all Frames.
> procedure TMainForm.alignControls(AControl : TControl; var ARect:TRect);
> begin
>  inherited alignControls(AControl, ARect);
> 
>  if (MyFrame1<>nil) then
>  begin
>   if MyFrame1.Visible then
>   begin
>  MyFrame1.Left := LeftPanel.Width;
>  MyFrame1.width := self.Width - LeftPanel.Width - 
> self.BorderWidth - 10;
>  MyFrame1.top := ToolBar1.Height + ToolBar2.Height;
>   end;
>  end;
> end;
> 
> 
> 
> This works bt cause display blinking, it is first aligned to the left 
> border and then replaced where i wanted.
> 
> if i try not to call the inherited alignControls when i 
> AControl=MyFrame1 then MDI Child appear below MyFrame1 !
> 
> I am not sure to be very clear. But if you have an help i would appreciate

The canonical way to get what you're describing using the 
standard VCL controls is to place a panel (or other container) to 
the right of your left aligned panel, set its Align property to 
alClient, then align your Frame and "MDI Child Area" within the 
righthand panel.

Stephen Posey
[EMAIL PROTECTED]


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Locking to Tpanel.

2005-12-19 Thread Stephen Posey
Rainer von Saleski wrote:
>>John Dammeyer wrote:
>>
>>
>>>How do I change the Tedit and Tlabel objects so they 'belong' to the 
>>>group
>>>box?
>>
>>The issue is Window parentage, this determines which window is responsible 
>>for displaying any "contained" controls (called its "Children" or "Child 
>>Controls").
>>
>>In order for the GroupBox to know it's supposed to serve as the Parent for 
>>these controls, they have to be inserted into the GroupBox in the form 
>>designer.
>>
>>If you already have controls that you want to keep, the simplest thing to 
>>do is:
>>
>>1. Select the controls in question.
>>2. Cut them to the clipboard.
>>3. Select the parent control (in your case the GroupBox).
>>4. Paste the controls back in.
>>
>>HTH
>>
>>Stephen Posey
>>[EMAIL PROTECTED]
>>
> 
> 
> Another (perhaps easier) solution is to move the control under the desired 
> parent in the Object TreeView.  Simply drag the WhateverBtn to PanelX (for 
> example).  You don't have to move anything in the form; Delphi will adjust 
> Top and Left to reflect the new position relative to the new parent object. 
> And the object will take its proper alphabetical place under the new parent.

The Object Treeview, eh?

You know, I hardly ever look at that Window, as I rarely saw the 
need. And I didn't know it would do what you describe.

Thanks for the tip!

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Locking to Tpanel. Was: Protecting Tedit Field.

2005-12-17 Thread Stephen Posey
John Dammeyer wrote:

> Hi Eddie,
> 
> That brings up an interesting question.
> 
> If I design the form and place a Tpanel or Group Box, and then place Tedit
> and Tlabel objects on the Group box they stay on top and get dragged around
> with the Tpanel or Group Box to whereever I place it on the form.
> 
> But if I put down a group box later, because I've decided I'd like to
> organize a number of fields, I can send the Group Box or Tpanel to the back
> but the Tlabels stay covered and the Tedit does go on top but they don't
> belong to the Group Box.  Dragging the Group box to another spot on the form
> leaves the fields behind.  
> 
> How do I change the Tedit and Tlabel objects so they 'belong' to the group
> box?

The issue is Window parentage, this determines which window is 
responsible for displaying any "contained" controls (called its 
"Children" or "Child Controls").

In order for the GroupBox to know it's supposed to serve as the 
Parent for these controls, they have to be inserted into the 
GroupBox in the form designer.

If you already have controls that you want to keep, the simplest 
thing to do is:

1. Select the controls in question.
2. Cut them to the clipboard.
3. Select the parent control (in your case the GroupBox).
4. Paste the controls back in.

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Darg?Drop Question

2005-12-14 Thread Stephen Posey
John Barrat wrote:

 > Steve – thanks for the input, however, I have implemented more 
 > or less what you suggest although not as a class.
 >
 > What I don’t understand is that it works in one application
 > when it’s at Main form yet it won’t when it is a secondary form
 > called up as a modal dialog.
 >
 > This is the code I have used:
 >
 > in the interface bit….
 >
 > public
 > { Public declarations }
 > procedure AcceptFiles( var msg : TMessage );
 >   message WM_DROPFILES;
 >
 > and in the implementation….
 >
 > procedure TfmAddLib.FormCreate(Sender: TObject);
 > begin
 >   DragAcceptFiles(LstFiles.Handle, True);
 > end;
 >
 > procedure TfmAddLib.AcceptFiles(var msg : TMessage);
 > const
 >   cnMaxFileNameLen = 255;
 > var
 >   i,
 >   nCount : integer;
 >   acFileName : array [0..cnMaxFileNameLen] of char;
 > begin
 >   // find out how many files we're accepting
 >   nCount := DragQueryFile( msg.WParam,
 >$,
 >acFileName,
 >cnMaxFileNameLen );
 >   // query Windows one at a time for the file name
 >   for i := 0 to nCount-1 do
 >   begin
 > DragQueryFile( msg.WParam, i,
 >acFileName, cnMaxFileNameLen );
 > if  CheckFileType(acFileName)
 > And (lstFiles.Items.IndexOf(acFileName) = -1) then
 >   LstFiles.Items.Add(acFileName);
 >   end;
 >
 >   // let Windows know that you're done
 >   DragFinish( msg.WParam );
 > end;
 >
 > If I change my create procedure to use the form handle it
 > works – yet this same code works on another application
 > where the listbox is sitting on the Main Form.

That's because the WM_DROPFILES implementation you've provided is 
a method of the FORM.

In the setup you've created, the our ListBox generates the "files 
dropped" condition. As the initiating HWND, the ListBox receives 
the WM_DROPFILES message back, but has no implementation for it.

The Form, has an implementation to handle it, but it doesn't 
receive the WM_DROPFILES message because it was not the 
initiating HWND.

Make sense?

Anyways, that's the intent of the "interposer" class 
re-implementation of TListBox I sent, it makes the TListBox 
responsible both for generating the dropped files condition as 
well as handling the message when it arrives.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Darg?Drop Question

2005-12-13 Thread Stephen Posey
John Barrat wrote:

> I'm dragging and dropping files from Explorer to my Application using the
> ShellAPI unit.
> 
> On my form I have a listbox to which I want to drag files.
> 
> In form.create I add 
> 
> DragAcceptFiles(lstFiles.Handles, True);  //where lstFiles is my list box.
> 
> This appears to work - i.e. cursor changes to Accept drop but the
> WM_DROPFILES message is not received.
> 
> If I use the form's handle it works but of course the Accept Drop Cursor
> appears anywhere on the form.
> 
> The form is not the main form of the application and is brought up as a
> modal dialog.  I have the same code running successfully with a listbox
> control on the Main form in another application. Could this be the
> difference?
> 
> Also, how do I determine what files are attempting to be dropped?  Ideally I
> would like to test what was being dropped while it was being dragged and
> only show the Accept Drop mouse cursor when files of the correct type were
> being dropped.

I've appended a simple unit that shows how you can tweak TListBox 
to recognize Shell drag and drop.  This should get you started, 
but you're welcome to Email me if this gives you any trouble.

I've used what I call an "interposer" class to implement this 
quickly; but if you're going to be using this a lot, there may 
some percentage in wrapping this functionality into a new component.

Alternatively you might care to download the old TurboPower 
ShellShock library off SourceForge, it has a component to attach 
shell drag-drop functionality to any windowed control.

HTH

Stephen Posey
[EMAIL PROTECTED]

>8 cut here 8<
unit Unit1;

interface

uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, 
Controls, Forms,
   Dialogs, StdCtrls,

   ShellAPI;

type
   TListBox = class(StdCtrls.TListBox)
 procedure WMDropFiles(var Msg: TWMDropFiles);
   message WM_DROPFILES;
   end;

   TForm1 = class(TForm)
 ListBox1: TListBox;
 procedure FormCreate(Sender: TObject);
   private
 { Private declarations }
   public
 { Public declarations }
   end;

var
   Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
   DragAcceptFiles( ListBox1.Handle, True );
end;


{ TListBox }

procedure TListBox.WMDropFiles(var Msg: TWMDropFiles);
var
   Count: Integer;
   i: Integer;
   Buff: array [0..255] of Char;
   S: string;
begin
   // passing $ for the second parameter
   // returns a count of dropped files
   Count := DragQueryFile(Msg.Drop, $, nil, 0);
   ShowMessage(IntToStr(Count) + ' file(s) dropped.');
   for i := 0 to Count-1 do begin
 DragQueryFile(Msg.Drop, i, @Buff[0], SizeOf(Buff));
 S := Buff;
 Items.Add( S );
   end;
end;

end.
>8 cut here 8<

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Test memory block

2005-11-04 Thread Stephen Posey
Ross Levis wrote:
> Hi Rob
> 
> The compiler is complaining about the const Zeros declaration
>Zeros: array[0..1023] of Byte = [0];
> 
> Incompatible types: 'Array' and 'Set'.

That's cause you're using set notation. Filling a typed constant 
array like that would look more like:

const
   Zeros: array[0..1023] of Byte = (0, 0, 0, {...}, 0);

You'll need to replace the "{...}" with sufficient zeros to fill 
the array.

> Should it perhaps need to be a global variable which I fill using 
> FillChar?

That should also work; though IIRC a globally declared variable 
is automatically zeroed by the compiler (in theory anyway).

BTW, if you're going to be dealing with a lot of similar sized 
buffers declared like that, you'd be well served to declare a 
type representing that, e.g.:

type
   TBufferArray: array[0..1023] of Byte;

const
   Zeros: TBufferArray = (0, 0, 0, {...}, 0);

var
   MyGlobalArray: TBufferArray;

Now you can perform direct assigments as these are all type 
compatible.


Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: DateUtils.dcu

2005-10-31 Thread Stephen Posey
Joe Echavarria wrote:

> Hi Bob,
> 
> What i was trying to say is that i can not compile my
> application anymore because of that error.
> 
> After i rename the file as you told me and now i get and error
> File not Found 'DateUtils.dcu', i think is not producing the
> dcu file for me, what should i do  ?
> 
> Thanks. JE

The source for that unit, DateUtils.pas, should be in the 
Source\Rtl\Common folder under your Delphi installation.

Make sure your project search path includes that folder, or copy 
DateUtils.pas into someplace it can find it.

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Multi column list box

2005-10-31 Thread Stephen Posey
Uttam Kumar Kotdiya wrote:
> We can make 2 column in Listbox component by setting its column property
> but how we can add/retrieve the values in/from second column.

Actually the "Columns" property is a bit of a misnomer, what it 
does is Wrap the list of items to make more of them visible 
(assuming the listbox is made wider than the entries), the 
logical list order remains the same.

There's an option to have columnar layout in a listbox by using 
the TabWidth property, which will spread things out based on tabs 
in the item text; but, again, this doesn't provide "columns" per 
se, there's still only a single list of items.

Using that you COULD parse the selected item and figure out the 
"column" based on the tabs; but there's no direct access to 
separate columns in the sense it sounds like you mean.

For that you'll probably want to look at TStringGrid or TListView.

HTH

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: random subarray

2005-10-20 Thread Stephen Posey
Malcolm Clark wrote:
>  >Great, very smart.
> Yes I was impressed when I read it. So simple. I think the original 
> context was a card dealing program.
> 
>  >I don't think the order of the input data is changed
> It is. You can easily check it.

If it's a fixed size array passed as a non-VAR parameter it 
shouldn't be changed, I'd consider it a compiler bug if that's 
not true.

Dynamic arrays are another story, they do get changed. Some quick 
tests showed that a way to counteract the effect is to construct 
the routines using open array parameters.

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Text file appears to have only one line

2005-10-18 Thread Stephen Posey
David J Taylor wrote:
> Delphi wrote:
> []
> 
>>The problem is that Readln() reads the whole file as one line.  When I
>>load this file into Textpad it show 13 lines.  What am I missing?
> 
> 
> Perhaps the file does not have the normal  sequences.  Does it 
> display correctly in Notepad?
> 
> Try using a TStringList.LoadFromFile method instead, and parsing the lines 
> after they are read in.

Given that the code is looking for '' sequences in the file, 
I'm guessing that it contains HTML code.

The HTML standard has no requirement for a particular line break 
sequence in the text of the HTML; whether Carriage Return, Line 
Feed, or a combination; or any line breaks at all for that matter.

HTML files received from non-DOS/Windows servers often will not 
conform to the Carriage Return+Line Feed sequence common on that 
platform.

Full HTML parsers expect this and don't concern themselves with 
line terminators.

So I suspect your assessment is probably spot on.

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Update TJpgImgList

2005-10-11 Thread Stephen Posey
Eric Daniels wrote:

> Wow Microsoft's image list is really crap
> 
> 25 bmp's all sized at 226k width 240 x height 320 made my exe file size 10 
> megs along with a 4 minute compile time clearly will not work
> 
> I've saved my bmp's to jpg format and compiled them into a resource file 
> with resource id 1 - 25 and wrote a procedure to load them from my exe file 
> and final outcome is an exe file size of only 800 k...
> 
> Simple Test Of MS's Control...
> 
> I placed an imagelist component on my form changed imagelist width to 240 
> and height to 320 and loaded one bmp file size 226k and compiled without 
> using the imagelist at all in my exe and the file size grew from 525k to an 
> astounding 1.7 megs by just placing one little bmp in that imagelist 
> component of which was never used in my exe file
> 
> Overall TJpgImgList will not use Microsoft's Image List Control because of 
> several reasons,  The birth of a better imagelist component might be on the 
> horizon :)_
> 
>  I haven't quite figured out the best methods for storing the images to be 
> included in the exe file...
> 
> The reason for this component was for a tetris game I wrote where each level 
> had a new background image upon completion of each level...
> 
> I used my quick and dirty method of building a res file with the jpg's and 
> compiling into my exe and loading the images with a custom written 
> procedure...
> 
> Finished File Size 823k and the game will save out the jpg's after there 
> displayed...  A Client request
> 
> Sorry for the long post but I wish I knew this information before taking on 
> this project...TJpgImgList is Still Under Construction

I might point out that there's a non-Microsoft COM Control 
implementation of a functional ImageList in CLX (in QImgList.pas).

Seems to me the Qt calls could probably be replaced with 
appropriate GDI or Graphics unit calls without too much trouble.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: display HTML on the form

2005-10-04 Thread Stephen Posey
Simeon Mitev wrote:

> Hi all,
> what is the simpliest way to display a heavy stored into application
> HTML text? Is the TWebBrowser the only choice?
> Thanks.

I wouldn't say it's the ONLY choice, but it certainly is one of 
the simpler ones.

How complicated is the HTML? Does it include Images? Scripts? 
Form controls?

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Lesser Known IDE Features You Find Useful

2005-10-03 Thread Stephen Posey
Robert Meek wrote:
>   What's really bad is that in D2005 it inserts the new procedure not
> at the end of the current list within the interface section, but at the
> beginning, while at the same time the procedure template is added to the
> bottom of the implementation section!  Why this changed I don't know but at
> first I tried getting around it as well by cutting and pasting either or
> both to keep everything in the order I like, but after awhile I simply got
> tired of having to do this and so now I just let it go where ever Delphi
> puts it and use the navigation bar provided by "Castilia" to move about!
> For those that do not know, this Nave bar sits within the toolbar section of
> the Delphi IDE and provides a dropdown list of all procs and funcs within
> the currently open unit.  They are always shown in alphabetical order in
> this combo box so all one has to do is find the one wanted and then click on
> it.  The cursor is then automatically placed at the beginning of whatever
> one is selected.  

Oh, yes, that is one of my favorite features of Castalia, and one 
  thing missing from the Delphi IDE that VB has had from the start.

The drop-down list of methods also updates itself to reflect 
which method the cursor is currently in; which is useful when 
quickly scanning through a unit or using the search method and 
you can't see the method header without scrolling.

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Referencing a component

2005-10-01 Thread Stephen Posey
Scott Kellish (@Work) wrote:

> Stephen,
> The instance of the object still exists despite not explicitly being
> assigned to a variable (local or global). From the limited code provided, it
> seems like all of the work is being done within the context of the with
> statement which is perfectly legitimate. We don't know what the OnEndPlay
> property looks like, but it would typically be something like:
> 
> TNotifyEvent = procedure(Sender: TObject) of object;
> 
> So that the called event handler gets an pointer to the object which could
> then be used to free it.

You're 100% correct, I overlooked the assignment of 
OnEndEventPlay to the OnEndPlay handler in the WITH statement 
(mea culpa).

> I would also urge some caution in freeing objects inside event handlers like
> David is doing. You have to absolutely sure that the code that calls your
> event handler, where you then free the object, does not do further
> processing after you return, because the object is effectively dead and
> memory released at that point.

Absolutely, you're basically pulling the rug out from under 
yourself like that.

> Back to the original problem though, if David is looking to somehow
> manipulate the instance outside of the PlaySoundCue method then I certainly
> agree that a hard reference to it needs to be held somewhere. From the code,
> it looks like the dsMixer object is the parent of the new TcbDSMixerChannel
> instance. Perhaps its easy enough just to iterate over the dsMixer
> Components collection to find the object. There's not enough information
> provided to speculate further.

Agreed.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Lesser Known IDE Features You Find Useful

2005-10-01 Thread Stephen Posey
Dušan Majkić wrote:

>>One of my personal favorites is the "Complete Class at Cursor" 
>>(Ctrl+Shift+C) function. 
>>
>>If you're in the class declaration, it will create skeleton 
>>method bodies in the implementation section. But more importantly 
> 
> 
>   And it works the other way around. 
> 
>   You can write method in implementatin section, and Ctrl+Shift+C 
>   will add it to the class declaration.

That was the first thing I mentioned:


If you're in the implementation section of a class, it adds any 
method headers you've added to the class declaration.


Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Lesser Known IDE Features You Find Useful

2005-10-01 Thread Stephen Posey
Steve Williams wrote:
> Stephen Posey wrote:
> 
>> One of my personal favorites is the "Complete Class at Cursor" 
>> (Ctrl+Shift+C) function.
> 
> Great feature, but only if you have Professional or higher.  At least, 
> that was the case with Delphi 7.  I haven't tried Delphi 2005 Personal.

It disappoints me to hear that's the case. It seems like Borland 
sometimes goes way out of their way to make the Personal versions 
  kind of brain dead.

I understand their desire to make the higher level versions more 
appealing, but I'm hard pressed to think IDE convenience features 
like Class Completion ought to be distinguishing marks.

>> If you don't it confuses the automatic code generation, and the IDE 
>> will simply start appending automatically generated methods at the end 
>> of the unit rather than contiguously with the class's other methods.
> 
> After a few executions of class completion on the same class, the IDE 
> confuses itself and starts adding new methods at the end instead of 
> alphabetically.  This is even if you have not manually added any methods.

I don't recall ever running into that myself, whenever the sort 
order has gotten broken I've always found it was something I did.

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Lesser Known IDE Features You Find Useful

2005-09-29 Thread Stephen Posey
Alan Colburn wrote:

> Hi all --
> 
> I thought it could be useful to all of us to get a thread
> going where we share IDE features (or even configurations)
> that we've found to boost our productivity. You might become
> more efficient or happy because of a feature you didn't know 
> was there--and you might be able to help others do the same :-)
> 
> In that spirit, I'll try to start ...
> 
> Code folding is a feature in D2005 that I find useful.
> However, the IDE also lets you define your own custom regions that
> can be folded and unfolded. If you've got a group of procedures, for
> example, that are similar and logically grouped together, you can
> fold and unfold the entire group as one.
> 
> At the beginning of the new region enter
> {$REGION 'Name of Region'}
> 
> followed by
> {$ENDREGION}
> at the region's endpoint.
> 
> What makes you more productive?

One of my personal favorites is the "Complete Class at Cursor" 
(Ctrl+Shift+C) function.

This function is context sensitive: If you're in the 
implementation section of a class, it adds any method headers 
you've added to the class declaration.

If you're in the class declaration, it will create skeleton 
method bodies in the implementation section. But more importantly 
(from my perspective) if you create a new property like so:

type
   Myclass = class
   published
 property MyProp : aType
   read FMyProp write SetMyProp;
   end;

And invoke the "Complete Class at Cursor" function, the IDE will 
add the Member variable, the setter method header, and the setter 
method body:

type
   Myclass = class
   private
 FMyProp: aType;
 procedure SetMyProp(const Value: aType);
   published
 property MyProp : aType
   read FMyProp write SetMyProp;
   end;

...
implementation

procedure Myclass.SetMyProp(const Value: aType);
begin
   FMyProp := Value;
end;


This action is smart enough to recognize whether the read and 
write refer to a Member variable or to getter and/or setter 
methods, or whether it's a read-only property; and behaves 
accordingly. It even handles array properties.

That's some mighty handy code generation when you're deep in 
class creation.

One caveat: if you add method bodies to the implementation 
section manually, it's worth the effort to keep them in 
alphabetical order.

If you don't it confuses the automatic code generation, and the 
IDE will simply start appending automatically generated methods 
at the end of the unit rather than contiguously with the class's 
other methods.

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Referencing a component

2005-09-29 Thread Stephen Posey
David Duffy wrote:
> I'm only into Delphi in a small way. (D7 professional)
> Normally I plonk components on forms and when I need
> to reference them I just use the component name. But...
> 
> I'm making a small audio player (freeware) and I am
> creating the audio channels as required as there are
> multiple sounds to be played at once sometimes.
> 
> I'm creating the instance ok (I think) and starting it
> playing, but can't get how to adjust it while it's in
> use. (playing) I'm freeing the instance in the OnEndPlay
> handler and that seem to work out ok. Help please? :-)
> 
> 
> function TfmMain.PlaySoundCue(CueRow: integer):boolean;
> var
>   SoundFilename: TFilename;
> begin
>   Result := False;
>   SoundFilename := GrCueList.Cells[6,CueRow];
>   if FileExists(SoundFilename) then begin
>with TcbDSMixerChannel.Create(dsMixer) do begin
> FileName := SoundFilename;
> Volume := -(3000-(StrToInt(GrCueList.Cells[4,CueRow])*30));
> Pan := StrToInt(GrCueList.Cells[5,CueRow])*30;
> Tag := CueRow;
> OnEndPlay := OnEndEventPlay;
> Name := 'Channel' + IntToStr(CueRow);
> Play;
> Result := True;
>end;
>   end;
> end;

Using the WITH statement like this, you've created an "anonymous" 
instance of the component, so  there's no way to refer to it 
outside the WITH statement (which makes me curious how you're 
referring to the instance to "[free] the instance in the 
OnEndPlay handler").

In order to have access to an instance like this in other places, 
you need to provide a global reference, which is most easily done 
by adding an instance variable of the appropriate type as a field 
of the form, something like:

   TfrmMain = class(TForm)
 ...
   public
 MixerChannel: TcbDSMixerChannel;
 PlaySoundCue(CueRow: integer):boolean;
   end;

Then in your method:

function TfmMain.PlaySoundCue(CueRow: integer):boolean;
var
   SoundFilename: TFilename;
begin
   Result := False;
   SoundFilename := GrCueList.Cells[6,CueRow];
   if FileExists(SoundFilename) then begin
MixerChannel := TcbDSMixerChannel.Create(dsMixer);
with MixerChannel do begin
    ...

Now you can refer to MixerChannel anywhere in your form code.

When you're ready to release the instance, just do:

   MixerChannel.Free;

Does that make sense?

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: dcc32.exe doesn't include version info (Delphi 2005)

2005-09-27 Thread Stephen Posey
Jack wrote:
> Hello All,
> 
> I'm using Delphi 2005. I configured version information in project
> properties. When I build from IDE, I right click on the exe file name
> in file explorer and option Properties, I see version info.
> 
> However, when I build it from command line with dcc32.exe, No version
> info is shown in Properties of the .exe file. I suppose version info
> is simply not included.
> 
> Does it mean that if I want to build from command line, I'll need
> to disable the IDE version and create a version rc file and include
> that file in the source code? This doesn't sound right but it seems
> the only solution so far.

In order for version info to be included, the compiler has to be 
able to find the projects's .RES file (as included by the "$R 
*.res" directive in the .DPR file).

The IDE will automatically generate an empty .RES file if it's 
not found; I'm not 100% sure what the command line compiler does 
in that situation; probably throws a warning, but it wouldn't or 
shouldn't completely halt compilation.

Is your command prompt changed to be in the folder where the 
project resides when you invoke DCC32; or are you including the 
path to the .RES file as part of a "-R" directive to DCC32?

Stephen Posey
[EMAIL PROTECTED]


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Hello, I'm Back

2005-09-22 Thread Stephen Posey
Rob Kennedy wrote:

>>Next, I'm looking for replacement components.  I used the RxLib components
>>quite a bit, particularly the TRxMemoryTable component and the FormStorage
>>component  Where can I get something similar?
> 
> What's wrong with what you already have? Delphi 2005 should be able to
> recompile whatever you used in older versions.

Not necessarily as-is. Components written for D3 (which the OP 
mentioned using) may need at least some new compiler defines created.

There have also been some pretty significant changes to the 
Property Editor architecture since D3, these may well not compile 
or function without some reworking.

Stephen Posey
[EMAIL PROTECTED]





___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Using Property Arrays of Record Type

2005-09-16 Thread Stephen Posey
John Barrat wrote:
> Can anyone advise me how to set up a Property which is an array of Record
> Types.
> 
> Here is a skeleton of my class code - the compiler does not like my use of
> Records in a Property Array

The problem is that you have the array property published, which 
makes it available at design time. There is no RTTI system for 
handling records so that won't work.

You can have an array property of records that's NOT published if 
you aren't looking to view them at design time.

If you are planning to expose these values at design time, the 
alternative is to use the collections mechanism and make your 
"records" into classes instead.

BTW, as-is if you move your pMacInfo property declaration into 
the public section you'll get a confusing "Incompatible Types" 
error.

This actually refers to the fact that you've got AIndex declared 
as CONST in the property declaration but not in the get accessor 
method GetMacInfo().

It needs to be the same in both places (either both CONST or both 
non-CONST).

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: File not found: 'ARROWGLYPH.RES'

2005-09-14 Thread Stephen Posey
Joe Echavarria wrote:
> Hello,
> I am trying to compile my program and i am getting this errror :
> File not found: 'ARROWGLYPH.RES', it was working fine before and
> I  haven't changed any information in the environment options
> what can i do to find the problem  and fix it ?, it could
> something of a library but i really don't know what to do.

Did you introduce any new components recently?

The error is indicative that the compiler can't locate a resource 
  (.RES) file that your project is importing.

I'd suggest doing a "Find in Files" on your source tree looking 
for "ARROWGLYPH.RES" that should turn up which unit(s) are 
looking for that file.

That should also tell you which library or component set it is, 
at which point you can determine if the file exists.

If it does exist then you need to add its path to the Library 
search path or move it where it can be found; or, if it does not 
exist, re-install the component or library from your source disks 
or archive to see if it's included and then contact the 
manufacturer if it's not there.

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: TMemo TDBMemo and Delete key

2005-09-10 Thread Stephen Posey
Robert Meek wrote:
>   It was the auto-shortcut that Delphi gives the standard edit action
> for delete that was blocking the key.  I'm not sure I understand why as of
> yet, but at least it's working correctly now.

Yeah, I read Rob Kennedy's suggestion and your reply after I'd hit the 
Send button :-/

Anyways, glad you figured it out.

>   As to the TBitButton...it's a descendant of the original from the
> Raize component set and it includes special framing options that can be used
> to really make these buttons look good.  I don't want to post a bmp to the
> list, but if you want I can send you one directly so you can see how it
> looks.  I create my own toolbar using the Raize Panel...again with special
> border and framing control and these buttons within.

Hmmm, the issue at stake is really whether or not your Toolbar buttons 
require a Windows handle and accept focus in order to have the nifty 
features you want.

If it were me, I'd take Ray's code and try replacing TBitBtn with 
TSpeedButton as the ancestor and see what happens.

TBitBtn and TSpeedButton are sufficiently similar internally that it 
might work and you'd get your nifty look without having to jump through 
hoops to manage the focus.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: TMemo TDBMemo and Delete key

2005-09-09 Thread Stephen Posey
Robert Meek wrote:

>   I'm using a TBitbutton descendant.  And it finally dawned on me that
>they were the problem so I just re-set the focus myself and they're just
>fine now, 
>
Just out of curiosity, what does TBitButton buy you that TSpeedButton 
doesn't for this situation?

>but as for the delete key...I haven't set up any keydown or
>keypress procedures using it, nor have I set any shortcuts to use it.  It
>does delete selected text, but not blank spaces or lines!
>  
>
Best I can offer you there is to have a look at your code, otherwise I'm 
baffled. I've never seen a TMemo behave like that.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: TStrings in a class

2005-09-08 Thread Stephen Posey
Robert Pointon wrote:
> I am trying to create a class that has a tstring list fill internally
> holding a list of names but I get access errors every time I try to add
> to the list.
> 
> This is the class code the idea is a value will be passed an the list
> will be filled accordingly;
> 
> calling with mlist.MyList:= memo1.Lines; works fine.
> calling with Mlist.Mynum := 99; Access error.

A couple of problems with the code you show:

1. You instantiate FMyList as a TStringList in your 
TInhertProducts constructor but never free it.

2. Calling mlist.MyList:= memo1.Lines, as you show, will clobber 
the internal reference to your internally constructed FMyList 
that you previously created; replacing it with a refrence to the 
TMemoStrings instance maintained by the TMemo.

Doing this makes it actually impossible to free the original 
TStringList (you no longer have a reference to it) and will cause 
problems if you later free it, as it now actually refers to the 
internal TStrings instance of another class.

If you were just meaning to COPY the values from one to the other 
  you want to use the overridden TStrings.Assign() method.

Beyond those issues, the class otherwise appears okay. I'm having 
trouble recreating an access error given what you've shown

Can you provide some context code showing where and how you're 
instantiating Mlist and actually accessing the methods?

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: TMemo TDBMemo and Delete key

2005-09-08 Thread Stephen Posey
Robert Meek wrote:

>   I finally solved my homemade toolbar's problem which prevented any
> standard actions like Copy and cut and paste, from working on Memo's by
> actually creating methods for each and then setting the focus back to the
> memo before and after the standard action code.  

What component are you using for your toolbar buttons? 
TSpeedButton and TToolBarButton don't take focus and shouldn't 
cause that problem.

> But for some reason I'm
> still having problems with the keyboard's delete key.  
>   Although it now works on any selected text in the TMemo, it does not
> delete blank spaces or lines as in other editors.  If anyone has a fix or
> workaround for this I would greatly appreciate it.

That's very bizarre, Delete behavior ought to be automatic in a 
Memo. Are you doing any customized keyboard handling in the Memo 
or its parent?

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Detecting Large Fonts

2005-09-02 Thread Stephen Posey
Cosmin Prund wrote:
> I also found this code, and an other variation (as I've sayd - I'm allready 
> using GetDeviceCaps) but it unfortunatelly says 96 on both my "normal font" 
> developement machine and on my "Extra Large Fonts" test machine :-(

Just so you know, this is not as simple an issue as it may appear 
and you're not alone:

http://blogs.msdn.com/oldnewthing/archive/2004/07/14/182971.aspx

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Printing to EPSON ESC/POS Printer

2005-08-25 Thread Stephen Posey
Pedro de Barros wrote:

> Hi,
> 
> I'm trying to develop an application that prints the contents of a TMemo 
> component to an EPSON ESC/POS printer (EPSON TM-U200).
> 
> However, I am having difficulty figuring out exactly how to do this, as I 
> only want to print ASCII text.

Before I jump to a conclusion and offer a possibly unhelpful 
solution, let me clarify:

Are you saying you can't figure out how to print to the Epson AT 
ALL, or just that you can't get it to print ASCII?

Stephen Posey
[EMAIL PROTECTED]


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Iranian calender

2005-08-25 Thread Stephen Posey
Arjang Assadi wrote:
> On 8/25/05, Stephen Posey <[EMAIL PROTECTED]> wrote:
> 
>>My guess is that he's not looking to simply translate the
>>calendar; but is rather looking to implement a calendar control
>>for the Muslim Religious calendar, which is a lunar based
>>calendar that doesn't jibe in simple fashion with the Gregorian
>>solar calendar; it's similar to the Jewish Religious calendar,
>>but has different months and start date.
> 
> In that case Iranian Calendar wont suite that task.
> Iranian Calender is Solar and non religious, it is based on the 4
> seasons and there used to have start date of 500BC, the new Iranian
> Calendar coincides with 662 AD. which is the start of Muslim calender.
> Without him saying what he really is after there is no point in
> providing anymore answers to an ambiguous question.

Agreed, we should wait for clarification rather than speculating 
in the dark.

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Iranian calender

2005-08-24 Thread Stephen Posey
Arjang Assadi wrote:
> Rich,
> The problem is to find out what Uttam is really after.
> The iranian or whatever calender is easyly achived by having a Unicode
> Calnder Control. How ever the displaying of dates would be a problem,
> e.g. 31/02/1371 is a valid date (in dd/mm/ format) but there is no
> way to get the usual Calendar to accept 31st of feb for what ever
> year.
> So my question is that does he whant to display Iranian dates with a
> calender that accepts any date values or a real iranian calender where
> the characters are also in Farsi.
> 
>  for a screen shot of a farsi calnder component look at
> http://www.farsicomponents.com/shdatepicker.htm
> 
> there is an open source java farsi component on source forge.
> 
> HTH
> 
> On 8/24/05, Rich Cooper <[EMAIL PROTECTED]> wrote:
> 
>>Can you send an image of an Iranian calendar?  I doubt if most of
>>us have ever seen one.  With an image, we may be able to offer suggestions
>>about how to implement it.

My guess is that he's not looking to simply translate the 
calendar; but is rather looking to implement a calendar control 
for the Muslim Religious calendar, which is a lunar based 
calendar that doesn't jibe in simple fashion with the Gregorian 
solar calendar; it's similar to the Jewish Religious calendar, 
but has different months and start date.

The only place I've seen solid logic for working with various 
calendars like this is this book:

Title: Standard C Date/Time Library:
   Programming the World's Calendars and Clocks
Author: Lance Latham
Publisher: CMP Books (May 1, 1998)
ISBN: 0879304960

http://www.amazon.com/exec/obidos/tg/detail/-/0879304960/qid=1124900971

Don't let the "Standard C" appelation put you off, it actually 
uses a form of C stripped down to where it's approaching 
pseudo-code and should be VERY easy to follow even for a C novice.

It's a terrific reference for anyone interested in calendars and 
time keeping.

I also found a few websites that may be of interest:

http://www.hoerstemeier.com/moon.htm
http://www.calendarzone.com/Software/
http://emr.cs.uiuc.edu/~reingold/calendars.shtml
http://ramsesgen.online.fr/en/ramcal.htm
http://www.skerryvoresoftware.com/SimplyCalenders/



Stephen Posey
[EMAIL PROTECTED]



___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Problem with Sendmessage

2005-08-05 Thread Stephen Posey
steppo klein wrote:

> Hello,
> 
> i tryed the Sourcecode from Thread "Need to pick your brains...!" from 
> Robert Meek
> Sat Feb 21 10:58:24 CST 2004
> 
> it's fantastic. But i have a Problem. If i start my Application with this 
> Sourcecode against the ContextMenu, the Application starts once. That is ok.
> If i start the my Application again against the Contextmenu, the second 
> Application do not start, but the Parameter is send to the First 
> Application. That is also Ok.
> 
> Now my Problem.
> 
> I select two Tif - Images against the Contextmenu and start my Application.
> 
> Result Application starts but only one Tif - Image is shown in my 
> Application.
> 
> Why?
> 
> Normaly the second marked File has been send to the first Application and be 
> shown as second Tif - Image. isn't it right, that if i start my Application 
> with to marked Files is the same like starting Application twice?

If I'm understanding your description, no it's not the same, it's 
like calling your application once with two filenames passed on 
the command line.

If your application is not set up to handle multiple filenames as 
command parameters, then the outcome will normally be that the 
second filename gets be ignored, which sounds like exactly what's 
happening.

Given what you've described, likely you need to call SendMessage 
for each filename separately (e.g. in a loop).

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: converting TControl to TWidgetControl

2005-07-26 Thread Stephen Posey
Hamar Gábor wrote:

> Hello,
> 
> Thank you! I've found the problem. I've used the QComControls unit,
> because according to the help TSpinEdit is in this unit, and there isn't
> a VCL version of this control. I think this could be a bug in the help.

That would definitely be a bug, there's been a TSpinEdit on the 
"Samples" tab since at least D4 (probably earlier). The VCL 
version of the component resides in the Spin.pas unit.

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: converting TControl to TWidgetControl

2005-07-22 Thread Stephen Posey
Hamar Gábor wrote:
> Hello!
> 
> I got the same compiler error message for this. I think this code does
> exactly the same as my code.

I can't seem to reproduce the problem at this end.

The error suggests to me that you've somehow intermingled VCL and 
CLX code, but I'm unclear how or where without more context.

Did you start with a CLX application? Did you add any units 
manually to the USES clause?

If none of that helps, can you forward to me the offending unit 
code, or a minimal one that recreates the problem just so I can 
see what's going on?

Stephen Posey
[EMAIL PROTECTED]
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Time Zone...

2005-07-09 Thread Stephen Posey

Colin Lehmann wrote:

Hi,
I am writing a small utility to convert GMT to local time. To do this I
need to read the time zone I am in, set in Settings/Control
Panel/Date/Time.
Can anyone tell me how to get this value from the system?


Have a look at the GetTimeZoneInformation() Windows API call.

Stephen Posey
[EMAIL PROTECTED]


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Checkboxes & Radiobuttons

2005-07-08 Thread Stephen Posey

Mike Lucek wrote:

How do you prevent the dotted border from appearing around the caption when
a checkboz or radiobutton is clicked?


That's normal Windows behavior for these controls when they 
receive the input focus, I'd caution strongly against changing that.


But if you feel you must, probably the simplest thing to do is 
send the focus somewhere else innocuous whenever one of them is 
clicked.


Are you ignoring the keyboard interface for these? Sending the 
focus elsewhere will tend to break up your tab order.


Otherwise you can investigate doing OwnerDraw on these and not 
drawing the focus rectangle as part of that, but again, you'll be 
violating a lot of UI standards not having a focus indication.


Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Word processing components

2005-06-22 Thread Stephen Posey

Grant Brown wrote:

No we would prefer a VCL type word processing suite of components - any 
suggestions are welcome though.



WP Tools is the only full VCL implementation of a really complete 
word processing component set of which I'm aware, and they're 
probably worth the wait if you can delay your project and work 
with demo or older versions until their site is back up.



There's TRichView, available here:

  http://www.trichview.com/features/

I'm unclear on precisely how complete its editing capabilities 
are and whether or not it makes use of the Microsoft RICHEDIT 
control under the covers.



Other than that, depending on how sophisticated your formatting 
needs are, you might want to have a look at PlusMemo from 
Electro-Concept Mauricie:


  http://www.ecmqc.com/plusmemo/pmHome.htm

This is a complete VCL implementation of an enhanced TMemo that 
allows for complex formatting including bold, italic, underline, 
colors, mixed fonts at two different sizes. The formatted text 
can be exported to .RTF or .HTML.



On the .DLL/.OCX front, you have several choices, I've only tried 
a couple of these, and that was several years ago, so I really 
can't speak to their quality, features, or ease of use within 
Delphi; sorry:


ActiveLedIt from Sophist Solutions
http://www.sophists.com/Led/ActiveLedIt/

ALLText HT/Pro from Bennett-Tec
http://www.bennet-tec.com/btproducts/ALLText/ALLText.htm

SpellEditor from Chado Software
http://www.chado-software.com/screensspelleditor.htm

TE Edit control from SubSystems
http://www.subsystems.com/tewf.htm

TX Text Control from The Imaging Source
http://www.textcontrol.com/

HTH

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: memo.setTextBuffer and perform.

2005-06-21 Thread Stephen Posey

websmith wrote:

allo,

i'm using CLX and am surprised that there was no memo.setTextBuf and the 
memo.Perform methods. any idea.


The CLX components are wrappers around the Qt class/component 
library which implements a very different architecture than you 
may be used to and the mapping between CLX and the VCL is not 
100% perfect.


In particular, unlike the VCL, MFC, OWL and other Windows 
libraries they do not represent a more or less thin layer of 
abstraction over the Windows standard controls and messaging system.


If anything Qt is an abstraction of the KDE Widget set on Linux 
and the "signal/handler" architecture that is the closest thing 
to the universal Windows message loop that Linux has.


This Qt model has been tweaked and ported to abstract it to other 
GUI architectures, mainly the Mac UI and Windows; and now CLX is 
an Object Pascal wrapper around Qt for Kylix and Delphi (Got all 
that?)


So, the resulting model for a multiline edit control (i.e. a 
Memo) reflects the abstracted KDE/Qt heritage rather than the 
Windows one. A CLX memo, then, can't (or shouldn't) assume 
there's a Windows Control underneath.


Now, arguably, if there's a way to set the Text property, there 
has to be some way to pass a string to the control; and you could 
probably kluge a .SetTextBuf for yourself if it really bothers 
you not to have it.


The issue in creating the CLX Memo probably was that it didn't 
buy you anything performance-wise over just setting the .Text 
property; unlike using the VCL .SetTextBuff does.


.Perform is a different kettle of worms: in TWinControl, calling 
Perform actually calls the routine that is used to process 
Windows messages. Conceptually a CLX control isn't a Windows 
control, so (again conceptually) there are no Windows messages to 
process.


Now, when running on Windows, of course in the depths of Qt 
there's undoubtedly a Windows multiline EDIT control SOMEWHERE 
underneath the CLX Memo.


And there's probably some fancy footwork you could to do get at 
it and manipulate it as a Windows control and send Windows 
messages to it, but that would sort of defeat the purpose of 
creating a (theoretically cross-platform) CLX application (all 
that code would break if you ported it to Linux).


If you want that kind of flexibility or control, why not just 
make a VCL app?


Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Word processing components

2005-06-20 Thread Stephen Posey

Grant Brown wrote:


Hi to all,

using D5,

A client of our has requested that we add full word processing ability 
to an app that we have written for them. We where going to purchase and 
use the WP Tools components but that are off line until 28 June and we 
do not have the time to wait till then.


Does anyone know of a similar component suite that we could have a look 
at ?


Do you requre full Delphi source, or will something encapsulated 
in a DLL or ActiveX control with a Delphi wrapper fill the bill?


Stephen Posey
[EMAIL PROTECTED]




___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Re: Paper margin

2005-06-16 Thread Stephen Posey

Cosmin Prund wrote:
I'm working on a program that prints on pre-printed forms and I'm having 
lots of trouble figuring out paper margins. It seems the GetDeviceCaps 
API gives the wrong results for the PHYSICALOFFSETX / PHYSICALOFFSETY 
parameters.


Is there a way to find the ACTUAL offset for a given printer in any 
real-world coordinate system? Knowing my application will mostly be used 
on HP printers, is there a way to find this using something like HP PCL 
or similar? Anything other then printing something and measuring white 
bands is acceptable!


Before we get too far afield, how about posting some code for how 
you're making your position calculations?


I find it's real easy to get confused about the meaning of what 
some of the different GetDeviceCaps() Indicies refer to; not to 
mention adding everything up and keeping it all oriented correctly.


Sometimes another pair of eyes...

Stephen Posey
[EMAIL PROTECTED]

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


  1   2   >