Solved

Using the TSpeedItem on TSpeedBar in the RX library

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now