Converting Borland C++ app to C# (question about Button type)

  • Thread starter Thread starter Jungle Boy
  • Start date Start date
J

Jungle Boy

I'm trying to convert a Borland C++ app to C#

Borland C++ has 3 types of buttons:
TButton, TBitBtn and TSpeedbutton

TSpeedbutton has 'Down' and 'GroupIndex' properties.

The 'Down' state is useful for controlling the button up/down
state from say a timer event.

The 'GroupIndex' allows a group of SpeedButtons to act like
radio buttons. A value of 0 switches this feature off.

C# doesn't seem to have anything like this.

Does anyone know how I can access these features?

-JB
 
Hello Jungle,
Borland C++ has 3 types of buttons:
TButton, TBitBtn and TSpeedbutton

These are controls that Borland created themselves, they are not part of
the .NET framework.

The standard Button control in the .NET Framework can show an image, but I
don't think it has an equivalent of the Down or GroupIndex properties. You
might want to look into one of the available third party control packages,
there's an abundance of these and most can probably satisfy your
requirements.


Oliver Sturm
 
Hi,

It's not C# it's the framework that do not have those classes.

Do you need those extra features?

Otherwise just use the "regular" Button , you will need to rewrite some more
code though (but I see no way to avoid that anyway)
 
Hello JB,
The 'Down' state is useful for controlling the button up/down
state from say a timer event.
The 'GroupIndex' allows a group of SpeedButtons to act like
radio buttons. A value of 0 switches this feature off.
C# doesn't seem to have anything like this.

True, there isn't a one-to-one mapping in these features between OWL
(Borland C++) or VCL (Borland C++Builder) and C#/WinForms.

However, .NET's ToolStrip container and its ToolStripButtons have a property
called Checked (and the linked CheckedState property) that is essentially
the same as your TSpeedButton's Down property. Yes, the button doesn't go
"down", but instead changes color, which is the modern Windows convention to
the older 90s convention/visualization used by Borland C++.

Now, GroupIndex is something I think you cannot do without coding, at least
from the top of my head. However, creating a group of ToolStripButtons that
would act as a group is almost trivial. In fact, you might wish to inherit
your own buttons from ToolStripButton, which could have this feature
implemented "built-in".

Hope this helps.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 
Jungle said:
I'm trying to convert a Borland C++ app to C#

Borland C++ has 3 types of buttons:
TButton, TBitBtn and TSpeedbutton

TSpeedbutton has 'Down' and 'GroupIndex' properties.

The 'Down' state is useful for controlling the button up/down
state from say a timer event.

The 'GroupIndex' allows a group of SpeedButtons to act like
radio buttons. A value of 0 switches this feature off.

Can't you use RadioButtons and set their Appearance property to Button?
If you put them inside a GroupBox, doesn't that give you the
functionality you need?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top