Jump to content
Sign in to follow this  
[evo] dan

Dialog Button Problems

Recommended Posts

I have been messing around, trying to get buttons on dialogs working. I managed to get it to work, however, I seem to have found an annoying little thing. When I activate the dialog which creates the button, the button is spawned. When I have the mouse over the button it stays one colour, however, when I remove my mouse from the button (without clicking said button), it pulsates red and white, my question is how do I go about stopping this from happening, and is this meant to be the default behaviour of the button. This is the biki page I used for the example:

http://community.bistudio.com/wiki/DialogControls-Buttons

and here is the code that I have used:

Dialog activation:

_ok = createDialog "SecondDialog";
waitUntil { !dialog }; // hit ESC to close it
hint "Dialog closed.";

Dialog classes:

#include "resources.cpp"
#define true 1
#define true 0
#define FontM Bitstream
class SecondDialog {
idd = -1;                      // set to -1, because we don't require a unique ID
movingEnable = false;           // the dialog can be moved with the mouse (see "moving" below)
enableSimulation = false;      // freeze the game
controlsBackground[] = { };    // no background controls needed
objects[] = { };               // no objects needed
controls[] = { MyButton }; 

class MyButton {
	idc = -1;
	type = CT_BUTTON;
	style = ST_CENTER;
	default = false;
	font = FontM;
	sizeEx = 0.03;
	colorText[] = { 0, 0, 0, 1 };
	colorFocused[] = { 1, 0, 0, 1 };   // border color for focused state
	colorDisabled[] = { 0, 0, 1, 0.7 };   // text color for disabled state
	colorBackground[] = { 1, 1, 1, 0.8 };
	colorBackgroundDisabled[] = { 1, 1, 1, 0.5 };   // background color for disabled state
	colorBackgroundActive[] = { 1, 1, 1, 1 };   // background color for active state
	offsetX = 0.003;
	offsetY = 0.003;
	offsetPressedX = 0.002;
	offsetPressedY = 0.002;
	colorShadow[] = { 0, 0, 0, 0.5 };
	colorBorder[] = { 0, 0, 0, 1 };
	borderSize = 0;
	soundEnter[] = { "", 0, 1 };  // no sound
	soundPush[] = { "", 0.1, 1 };
	soundClick[] = { "", 0, 1 };  // no sound
	soundEscape[] = { "", 0, 1 };  // no sound
	x = 0.4; y = 0.475;
	w = 0.2; h = 0.05;
	text = "Close";
	action = "closeDialog 0; hint ""Dialog closed. You are good to go now!""";
};
};

Thank you in advance for any help.

Share this post


Link to post
Share on other sites

i too have had this problem - not sure why it happens - if you create another button and then click on your first one. it will then flash - if you dont click any of the buttons the last one created in the script or first one(cant remember which way) will flash on the dialog opening. Sorry cant be of any more help

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×