Page 1 of 1

buttons and dropdowns

Posted: 24 March 2013, 22:18
by ddyer
None of the sample code has buttons or dropdowns. It would be good to use
site-standard artwork templates for buttons and translatable button text.

Re: buttons and dropdowns

Posted: 26 March 2013, 17:38
by Rudolf
Here is an example of what I used... before erasing button and choose text with 'link' to have uniform behaviour than the other games ;)
For foreign language, you can edit text property of th button in the initdata() (with dojo.byID(buttonname)) to translate the text.
++
Rudolf

game.css:

Code: Select all

.styleNextStepButton
{
	left: 590px;
	top: -24px;
	z-index:6;
	}

#NextStepButton
{
	position:relative;
}
in game.tpl

Code: Select all

<div id="NextStepButton" class="styleNextStepButton">
	<input type="button" value="PASS" onclick="PassClick()" style="background-color:#3cb371" style="color:white; font-weight:bold"> 
in game.js

Code: Select all

function PassClick()
{
	switch (ActiveStep)
	{
		case 40: case 61: NextStep();
		default: return;
	}
}
[/code]

Re: buttons and dropdowns

Posted: 26 March 2013, 19:11
by sourisdudesert
Hello,

You can find the documentation about how to have a standard BGA button here:

http://en.doc.boardgamearena.com/Game_l ... ice_button

Cheers,

Re: buttons and dropdowns

Posted: 26 March 2013, 19:14
by sourisdudesert
Hello,

Concerning dropdown, for now we didn't have the need to have dropdown box in games (as far as I remember). I don't feel it's really "board game interface friendly" :) But if you feel it makes sense in a game, why not ?

All the best,

Re: buttons and dropdowns

Posted: 27 March 2013, 07:16
by ddyer
sourisdudesert wrote:Hello,

You can find the documentation about how to have a standard BGA button here:

http://en.doc.boardgamearena.com/Game_l ... ice_button

Cheers,
This led me to add

<a href="#" id="my_button_id" class="button" onClick="PassClick()"><span>Pass</span></a>

which gets me a button with the standard artwork, but it's not clear how to bridge
from the plain javascript environment of "PassClick" to the environment of OnClickInterSection

Re: buttons and dropdowns

Posted: 27 March 2013, 16:06
by Rudolf
In this case, (maybe?) use

Code: Select all

this.addActionButton( 'zebutton', _(' Pass this action'), 'OnClickInterSection');
The text is under translation core


Or you can generate the Onclick when you need?

Code: Select all

dojo.connect ($('zebutton'),'onClick',this,'OnClickInterSection'); 
hope it will help
§Rudolf§

Re: buttons and dropdowns

Posted: 28 March 2013, 16:50
by sourisdudesert
Hello,

The second solution of Rudolf (dojo.connect) is the right one. You can also use "addActionButton", but only for buttons in the main action status bar.

Cheers,