HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Clean Engine CSS area - radio buttons?  (Read 1432 times)

craigbe

  • Developers
  • *
  • Posts: 69
    • View Profile
[Resolved] Clean Engine CSS area - radio buttons?
« on: Mar 04, 13, 05:06:28 PM »

Ok, I know I'm asking tons of questions about this but having trouble implementing character switching.  I want to replace the radio buttons that show up with regular buttons like the social reference has but I can't find where they are being created.  If I search everything for '_radiobutton' (the prototoype) there is nothing.. if I search the scripts for just 'radioButton' again nothing.. where the heck are they coming from?

Thanks!

Craig
« Last Edit: Mar 12, 13, 01:27:07 PM by HE-Cooper »
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Clean Engine CSS area - radio buttons?
« Reply #1 on: Mar 04, 13, 05:46:01 PM »

Without just giving it away, I'll give you a hint:  Since it is the CSS system, filter the GUIXML script picker for css.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

craigbe

  • Developers
  • *
  • Posts: 69
    • View Profile
Re: Clean Engine CSS area - radio buttons?
« Reply #2 on: Mar 05, 13, 07:32:41 AM »

Thanks Scott, I've been looking at the gui's xml in our repository.  I want to change the radiobutton to a regular button in there, but I can't find what a 'regular' button is in the wiki.  I've been searching on 'guibutton' etc without much luck.  Can you give me any additional pointers?  I feel like I'm missing something obvious.

Thanks,

Craig
Logged

Grogard

  • World Owners
  • ****
  • Posts: 36
    • View Profile
Re: Clean Engine CSS area - radio buttons?
« Reply #3 on: Mar 05, 13, 08:43:52 AM »

Pls, read this page: http://hewiki.heroengine.com/wiki/GUI_Controls

And about button. Just open any existing window in GUI Editor and select any button, for example Character Selection window. And in the property you can found the prototype from this element was created.
Logged

craigbe

  • Developers
  • *
  • Posts: 69
    • View Profile
Re: Clean Engine CSS area - radio buttons?
« Reply #4 on: Mar 05, 13, 11:32:14 AM »

Thanks Grogard, problem with the default panel is the radio buttons are dynamically generated so you can't click them to check them out.  I do see them defined in the xml file though.  It appears they are part of the _characterSelectionName item which consists of a panel, name label, and radio button.  That's why it was so hard for me to find.

Craig
Logged

Grogard

  • World Owners
  • ****
  • Posts: 36
    • View Profile
Re: Clean Engine CSS area - radio buttons?
« Reply #5 on: Mar 06, 13, 03:43:56 AM »

If i rigth undertand you need to dynamic create some button on the GUI form?
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1144
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Clean Engine CSS area - radio buttons?
« Reply #6 on: Mar 06, 13, 12:45:15 PM »

The ones they use in the GUI editor are _radioButton.

When I created my own buttons, I used a mix of the radio button and the normal button. This way it has only a texture, and not all the sides which come with the dynamic buttons. It is basically a button.

In the DOM, create new My_button
archtype is guicontrol
add parent _Guibutton

In the GUI editor create new
name My_button
inherit from _radioButton
class My_button

In properties set size and texture.
When you add the button to a gui, set the name, and location.

Code: [Select]

method _OnButtonMouseClick(button as NodeRef of Class _GUIButton, args references Class GUIMouseEvent)
  myChoice as string = "choice1"
  selectedColor as Class rgba = setSelectedColor(myChoice)
  type as NodeRef of Class GUIControl

  when button.name
    is "myButtonName1"
      clearAllButtons()
      type.defaultStatePresentation.color = setSelectedColor    // set this button as highlighted - radio selection
      // do stuff for this button
    .
    is "myButtonName2"
      clearAllButtons()
      type.defaultStatePresentation.color = setSelectedColor    // set this button as highlighted - radio selection
      // do stuff for this button
    .
  .
.

// set buttons to same color
function clearAllButtons()
  Loc as NodeRef of Class GUIControl = FindGUIControlByName(None, "myButtonPanel")
  myChoice as string = "choice1"
  setColor as Class rgba = setMainColor(myChoice)
  type as NodeRef of Class GUIControl

  type = findGUIControlByName(Loc, "myButtonName1")
  type.defaultStatePresentation.color = setColor

  type = findGUIControlByName(Loc, "myButtonName2")
  type.defaultStatePresentation.color = setColor
.

// set main color for button
function setMainColor(myChoice as string) as Class rgba
  setColor as Class rgba

  when myChoice
    is "choice1"
       setColor = MiscUtils:MakeRGBA( 0, 0, 0.8, 1 )  // dk blue
    .
    is "choice2"
       setColor = MiscUtils:MakeRGBA( 0.8, 0, 0, 1 )  // dk red
    .
  return setColor
.

// set selected color for button
function setSelectedColor(myChoice as string) as Class rgba
  setColor as Class rgba

  when myChoice
    is "choice1"
       setColor = MiscUtils:MakeRGBA( 0, 0, 1, 1 )  // blue
    .
    is "choice2"
       setColor = MiscUtils:MakeRGBA( 1, 0, 0, 1 )  // red
    .
  return setColor
.

Logged

craigbe

  • Developers
  • *
  • Posts: 69
    • View Profile
Re: Clean Engine CSS area - radio buttons?
« Reply #7 on: Mar 07, 13, 05:51:14 PM »

I think this post can be closed out and resolved.

Craig
Logged