Solved

Using the TSpeedItem on TSpeedBar in the RX library

Posted on 1998-03-05
5
980 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 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