winform in c++ (or maybe c#) or WinAPI

This is a discussion on winform in c++ (or maybe c#) or WinAPI within the Windows Programming forums, part of the Platform Specific Boards category; How can I use arrays of buttons (in c++ ?) Because it is a managed code , and a c ...

  1. #1
    Registered User gilit2's Avatar
    Join Date
    Jan 2011
    Location
    Israel
    Posts
    10

    winform in c++ (or maybe c#) or WinAPI

    How can I use arrays of buttons (in c++ ?)
    Because it is a managed code , and a c array is native - it did not accept it.

    Can I use array of buttons directly using the winapi ? where can I see a sample of using the winAPI directly. ?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    theForger's Win32 API Tutorial

    At the winapi level there is no such thing as an "array of buttons", this is some concoction of a higher level language. There are, however, ways to link multiple buttons into mutually exclusive groups so that if you check one the others become unchecked.... this is done by the way you set the button's window styles.

  3. #3
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,159
    Isn't there some way to maintain an array of pointers to the Buttons via the Button.Handle property?
    If you understand what you're doing, you're not learning anything.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    A button in C# is a control. You should be able to create a list of these with no problem in C#. Why are you asking managed questions, though, on an unmanaged forum? We have a forum for C#. I will not move the thread yet b/c your post was so vague that I'm not sure what you are asking about.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Bubba View Post
    A button in C# is a control. You should be able to create a list of these with no problem in C#. Why are you asking managed questions, though, on an unmanaged forum? We have a forum for C#. I will not move the thread yet b/c your post was so vague that I'm not sure what you are asking about.
    FWIW... I've seen the "array of buttons" thing before. Most often it refers to a group of buttons in a groupbox that are mutually exclusive (i.e. radio buttons). Windows maintains this invisibly by making any contiguous group of buttons with the BS_RADIOBUTTON style, mutually exclusive.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    FWIW... I've seen the "array of buttons" thing before. Most often it refers to a group of buttons in a groupbox that are mutually exclusive (i.e. radio buttons). Windows maintains this invisibly by making any contiguous group of buttons with the BS_RADIOBUTTON style, mutually exclusive.
    If you drag the radio buttons into the same group box this is done automatically. If you look at the resulting .designer.cs file you can see exactly how this is done in code.

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Bubba View Post
    If you drag the radio buttons into the same group box this is done automatically. If you look at the resulting .designer.cs file you can see exactly how this is done in code.
    Its done automatically by CreateWindow() *anyway*...

    Make the group box with the WS_GROUP style.
    Make your buttons right after with the BS_RADIOBUTTON style
    Make your next control with the WS_GROUP style.

    All the buttons between the two controls with WS_GROUP will be a mutually exclusive group. It's nothing special, just a matter of organization.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with WinApi ?
    By Sevko in forum Windows Programming
    Replies: 7
    Last Post: 01-01-2011, 08:18 PM
  2. Write to Console from a WinForm
    By ginoitalo in forum C# Programming
    Replies: 2
    Last Post: 10-19-2003, 06:20 PM
  3. do i still need winAPI
    By datainjector in forum Windows Programming
    Replies: 8
    Last Post: 07-12-2003, 01:43 AM
  4. references for the winapi
    By stallion in forum Windows Programming
    Replies: 9
    Last Post: 01-28-2003, 01:56 AM
  5. C++ and WinAPI?
    By Matt2u in forum C++ Programming
    Replies: 9
    Last Post: 01-08-2002, 11:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21