Jump to content
Sign in to follow this  
-FW- Shaanguy

Dialog (Listbox) ??

Recommended Posts

spawn_dialog.hpp

class SPAWN_DIALOG

{

idd = -1;

movingenable = false;

onLoad = "[] execVM 'SPAWN_settings.sqf'";

class Controls

{

////////////////////////////////////////////////////////

// GUI EDITOR OUTPUT START (by shaan, v1.063, #Sapide)

////////////////////////////////////////////////////////

class SC_ListBox: RscListbox

{

idc = 1500;

text = "List Box"; //--- ToDo: Localize;

x = 0.380547 * safezoneW + safezoneX;

y = 0.176985 * safezoneH + safezoneY;

w = 0.175198 * safezoneW;

h = 0.476022 * safezoneH;

};

class SC_Button_Spawn: RscButton

{

idc = 1600;

text = "Spawn"; //--- ToDo: Localize;

x = 0.380547 * safezoneW + safezoneX;

y = 0.653007 * safezoneH + safezoneY;

w = 0.175198 * safezoneW;

h = 0.0340016 * safezoneH;

action = "[] execVM 'spawn.sqf'";

};

////////////////////////////////////////////////////////

// GUI EDITOR OUTPUT END

////////////////////////////////////////////////////////

};

};

spawn_defines.hpp

///////////////////////////////////////////////////////////////////////////

/// Styles

///////////////////////////////////////////////////////////////////////////

// Control types

#define CT_STATIC 0

#define CT_BUTTON 1

#define CT_EDIT 2

#define CT_SLIDER 3

#define CT_COMBO 4

#define CT_LISTBOX 5

#define CT_TOOLBOX 6

#define CT_CHECKBOXES 7

#define CT_PROGRESS 8

#define CT_HTML 9

#define CT_STATIC_SKEW 10

#define CT_ACTIVETEXT 11

#define CT_TREE 12

#define CT_STRUCTURED_TEXT 13

#define CT_CONTEXT_MENU 14

#define CT_CONTROLS_GROUP 15

#define CT_SHORTCUTBUTTON 16

#define CT_XKEYDESC 40

#define CT_XBUTTON 41

#define CT_XLISTBOX 42

#define CT_XSLIDER 43

#define CT_XCOMBO 44

#define CT_ANIMATED_TEXTURE 45

#define CT_OBJECT 80

#define CT_OBJECT_ZOOM 81

#define CT_OBJECT_CONTAINER 82

#define CT_OBJECT_CONT_ANIM 83

#define CT_LINEBREAK 98

#define CT_USER 99

#define CT_MAP 100

#define CT_MAP_MAIN 101

#define CT_LISTNBOX 102

#define CT_CHECKBOX 77

// Static styles

#define ST_POS 0x0F

#define ST_HPOS 0x03

#define ST_VPOS 0x0C

#define ST_LEFT 0x00

#define ST_RIGHT 0x01

#define ST_CENTER 0x02

#define ST_DOWN 0x04

#define ST_UP 0x08

#define ST_VCENTER 0x0C

#define ST_TYPE 0xF0

#define ST_SINGLE 0x00

#define ST_MULTI 0x10

#define ST_TITLE_BAR 0x20

#define ST_PICTURE 0x30

#define ST_FRAME 0x40

#define ST_BACKGROUND 0x50

#define ST_GROUP_BOX 0x60

#define ST_GROUP_BOX2 0x70

#define ST_HUD_BACKGROUND 0x80

#define ST_TILE_PICTURE 0x90

#define ST_WITH_RECT 0xA0

#define ST_LINE 0xB0

#define ST_SHADOW 0x100

#define ST_NO_RECT 0x200

#define ST_KEEP_ASPECT_RATIO 0x800

#define ST_TITLE ST_TITLE_BAR + ST_CENTER

// Slider styles

#define SL_DIR 0x400

#define SL_VERT 0

#define SL_HORZ 0x400

#define SL_TEXTURES 0x10

// progress bar

#define ST_VERTICAL 0x01

#define ST_HORIZONTAL 0

// Listbox styles

#define LB_TEXTURES 0x10

#define LB_MULTI 0x20

// Tree styles

#define TR_SHOWROOT 1

#define TR_AUTOCOLLAPSE 2

// MessageBox styles

#define MB_BUTTON_OK 1

#define MB_BUTTON_CANCEL 2

#define MB_BUTTON_USER 4

///////////////////////////////////////////////////////////////////////////

/// Base Classes

///////////////////////////////////////////////////////////////////////////

class RscListBox

{

deletable = 0;

fade = 0;

access = 0;

type = CT_LISTBOX;

w = 0.4;

h = 0.4;

rowHeight = 0;

colorText[] =

{

1,

1,

1,

1

};

colorDisabled[] =

{

1,

1,

1,

0.25

};

colorScrollbar[] =

{

1,

0,

0,

0

};

colorSelect[] =

{

0,

0,

0,

1

};

colorSelect2[] =

{

0,

0,

0,

1

};

colorSelectBackground[] =

{

0.95,

0.95,

0.95,

1

};

colorSelectBackground2[] =

{

1,

1,

1,

0.5

};

colorBackground[] =

{

0,

0,

0,

0.3

};

soundSelect[] =

{

"\A3\ui_f\data\sound\RscListbox\soundSelect",

0.09,

1

};

autoScrollSpeed = -1;

autoScrollDelay = 5;

autoScrollRewind = 0;

arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";

arrowFull = "#(argb,8,8,3)color(1,1,1,1)";

colorPicture[] =

{

1,

1,

1,

1

};

colorPictureSelected[] =

{

1,

1,

1,

1

};

colorPictudeDisabled[] =

{

1,

1,

1,

0.25

};

tooltipColorText[] =

{

1,

1,

1,

1

};

tooltipColorBox[] =

{

1,

1,

1,

1

};

tooltipColorShade[] =

{

0,

0,

0,

0.65

};

class ListScrollBar

{

color[] =

{

1,

1,

1,

1

};

autoScrollEnabled = 1;

};

style = ST_MULTI;

font = "PuristaMedium";

sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";

shadow = 0;

colorShadow[] =

{

0,

0,

0,

0.5

};

period = 1.2;

maxHistoryDelay = 1;

colorPictureDisabled[] =

{

1,

1,

1,

1

};

};

class RscButton

{

deletable = 0;

fade = 0;

access = 0;

type = CT_BUTTON;

text = "";

colorText[] =

{

1,

1,

1,

1

};

colorDisabled[] =

{

1,

1,

1,

0.25

};

colorBackground[] =

{

0.149,

0.639,

0.063,

1

};

colorBackgroundDisabled[] =

{

0,

0,

0,

0.5

};

colorBackgroundActive[] =

{

0,

0,

0,

1

};

colorFocused[] =

{

0,

0,

0,

1

};

colorShadow[] =

{

0,

0,

0,

0

};

colorBorder[] =

{

0,

0,

0,

1

};

soundEnter[] =

{

"\A3\ui_f\data\sound\RscButton\soundEnter",

0.09,

1

};

soundPush[] =

{

"\A3\ui_f\data\sound\RscButton\soundPush",

0.09,

1

};

soundClick[] =

{

"\A3\ui_f\data\sound\RscButton\soundClick",

0.09,

1

};

soundEscape[] =

{

"\A3\ui_f\data\sound\RscButton\soundEscape",

0.09,

1

};

style = ST_CENTER;

x = 0;

y = 0;

w = 0.095589;

h = 0.039216;

shadow = 2;

font = "PuristaMedium";

sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";

offsetX = 0;

offsetY = 0;

offsetPressedX = 0;

offsetPressedY = 0;

borderSize = 0;

};

spawn_settings.sqf // on load

2 = lbAdd [1500, "Rifleman"];
1 = lbAdd [1500, "Sniper"];

spawn // button clicked

// Nothing

i wanted to make a listbox condition when i clicked the button, something like this:

_lbselected = SPAWN_DIALOG lbIsSelected 1500;
if (_lbselected == "Sniper") then {BLA BLA BLA};

something like that,

this dialog is about before spawning, selecting classes, i did 2 , --- Rifleman & Sniper ---

SOLVED = TRUE

OTHER PROBLEM:

well this post solved, but there is a other problem, here:

http://forums.bistudio.com/showthread.php?190720-Dialog-ListBox-little-help-needed&p=2917440#post2917440

Sorry for a new thread, the other problem

Edited by [FW] Shaanguy
Problem Solved but there is a another problem

Share this post


Link to post
Share on other sites

You need to use the indexes to test with, something like this:

switch (lbCurSel 1500) do
{
case 0: {hint "You have selected Rifleman";};
case 1: {hint "You have selected Sniper";};
default {hint "I don't know how this happened, but you have selected an index that does not exist.";};
};

copy and replace your old button class with this:

class SC_Button_Spawn: RscButton
{
idc = 1600;
text = "Spawn"; //--- ToDo: Localize;
x = 0.380547 * safezoneW + safezoneX;
y = 0.653007 * safezoneH + safezoneY;
w = 0.175198 * safezoneW;
h = 0.0340016 * safezoneH;

action = 'switch (lbCurSel 1500) do{case 0: {hint "You have selected Rifleman";};case 1: {hint "You have selected Sniper";};default {hint "I don't know how this happened, but you have selected an index that does not exist.";};};';
};

You can also use lbSetData and do something with that, but that's a whole other can of beans.

Also, format...

Edited by DreadedEntity

Share this post


Link to post
Share on other sites
action = 'switch (lbCurSel 1500) do{case 0: {hint "You have selected Rifleman";};case 1: {hint "You have selected Sniper";};default {hint "I don\'t know how this happened, but you have selected an index that does not exist.";};};';

My nitpicking of the day: Escaping.

Share this post


Link to post
Share on other sites

Nitpicking isn't a bad thing... Especially when it results in clean, correct, and optimal coding.

Share this post


Link to post
Share on other sites
My nitpicking of the day: Escaping.

Not sure what you mean Johnny, that code should work just fine

Share this post


Link to post
Share on other sites

Well, I might be mistaken but I can't imagine this works properly as even the syntax highlighting points out that there's an escaping issue:

action = 'switch (lbCurSel 1500) do{case 0: {hint "You have selected Rifleman";};case 1: {hint "You have selected Sniper";};default {hint "I don't know how this happened, but you have selected an index that does not exist.";};};';

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  

×