Solved

Using the TSpeedItem on TSpeedBar in the RX library

Posted on 1998-03-05
5
981 Views
Last Modified: 2008-02-01
Hi,
The title says everything.
My problem is that in the onClick event when I try following
(sender as tspeeditem).caption I get a class cast error.
When I look at run time at the sender.class I can see it's
class is TSpeedButton (or something like that).
The problem is that TSpeedButton is an unknown type
so I cannot use (sender as tspeedButton).caption
Just Try what I sayd and you will understand.
My goal is to do following

if (sender as tspeeditem).caption = 'test' then
begin
...
end
else
begin
...
end

What do you thing ?
I'm using RX library 2.32.
Jeurk
0
Comment
Question by:jeurk
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1360095
Hi jeurk,

You can do it this way :

 if (Sender as TRXSpeedButton).Caption = 'test' then begin
 end
  else begin
  end;

Don't forget to add RXCtrls to the uses clausule!

Regards, Zif.
0
 
LVL 4

Author Comment

by:jeurk
ID: 1360096
Hello, thanks for the answer but I need to know something more.
I agree that what you say works.
The solution is done by adding rxctrls.
what I don't understand is that tspeedbarbutton is declared in
speedbar.pas so I tryed to include speedbar in de uses clausule.
At compilation it still says that it does not know tspeedbarbutton. After adding rxctrls it no longer complains.
I hope you'll understand what I mean ?
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1360097
I don't know exactly, haven't looked at the code, but if you see, in my code I use TRXSpeedButton and not TSpeedBarButton. TSpeedBarButton is a descendant of TRXSpeedButton.


0
 
LVL 4

Author Comment

by:jeurk
ID: 1360098
I tryed the thing and it did not work, actually. the caption property is not connected to the (Sender as TRXSpeedButton).Caption
I had to use the btnCaption for my prog to work.
Thanks for your help.

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1360099
Strange, I'd tested it myself on my computer and it did work exactly like I wrote here. Maybe it's a different version from yours and Delphi version too. Regards, Zif.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question