Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using the TSpeedItem on TSpeedBar in the RX library

Posted on 1998-03-05
5
Medium Priority
?
1,006 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 150 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

721 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