Jump to content

Recommended Posts

Hey

does anyone know how you create GUI that goes on top of other GUIs without making the previous GUI disappear? I'm using createDisplay to create the topmost messagebox like GUI but this makes rest of the GUI disappear until I call closeDisplay.

 

thanks!

  • Like 1

Share this post


Link to post
Share on other sites

It's a question of layers. So depending on how the other GUI are written.

You can also order these layers in your own display, using and ordering controls[] = {yourctrl1,yourctrl2,...yourlastctrl }; from yourctrl1 the farther, to yourlastctrl the closer.

 

Share this post


Link to post
Share on other sites

@pierremgi thanks but I think I was not clear about what I'm doing.

 

I'm using the createDialog to first create one dialog. Then I'm using createDisplay to create my messagebox like dialog on top of that. What happens is that the dialog created by createDialog disappears until I close the dialog created by createDisplay.

I wish the dialog created by createDialog would stay on background.

Share this post


Link to post
Share on other sites

I can't tell you how to fix that. On my mind, it's a normal behavior when you stack createDialog and createDisplay like this. Not sure, however.

Share this post


Link to post
Share on other sites

If it is just a message like a hintSilent but custom then you can just use cutRsc command.  Read the note from KK:

https://community.bistudio.com/wiki/createDialog

if you can share your code then we may be able to help you better.

Share this post


Link to post
Share on other sites

@HazJ here's my code.

 

 

// Dialog classes

class TradeAmountDlg
{
 idd = 123556;

 movingEnable = false;

 class controlsBackground 
 {
 
	class Background: IGUIBack
    {
	idc = 3700;
	
	x = 8 * GUI_GRID_W + GUI_GRID_X;
	y = 10 * GUI_GRID_H + GUI_GRID_Y;
	w = 20 * GUI_GRID_W;
	h = 15 * GUI_GRID_H;
	
	moving = false;
	
	colorBackground[] = {0,1,0,1};
	
    };
 };
	
 class objects 
 {
 };
	
	
class controls 
{

////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT START (by GC, v1.063, #Loriby)
////////////////////////////////////////////////////////

class RscSlider_1900: RscSlider
{
	onSliderPosChanged = "_this call tradeAmountChange";

	idc = 1900;
	x = 9 * GUI_GRID_W + GUI_GRID_X;
	y = 11 * GUI_GRID_H + GUI_GRID_Y;
	w = 19 * GUI_GRID_W;
	h = 2 * GUI_GRID_H;
};
class RscButton_1600: RscButton
{
	action = "call acceptTrade";

	idc = 1600;
	text = "Ok"; //--- ToDo: Localize;
	x = 13 * GUI_GRID_W + GUI_GRID_X;
	y = 15 * GUI_GRID_H + GUI_GRID_Y;
	w = 5 * GUI_GRID_W;
	h = 2 * GUI_GRID_H;
};
class RscButton_1601: RscButton
{
	action = "call cancelTrade";

	idc = 1601;
	text = "Cancel"; //--- ToDo: Localize;
	x = 19 * GUI_GRID_W + GUI_GRID_X;
	y = 15 * GUI_GRID_H + GUI_GRID_Y;
	w = 5 * GUI_GRID_W;
	h = 2 * GUI_GRID_H;
};
class RscText_1000: RscText
{
	style = ST_CENTER;

	idc = 1000;
	text = "Amount"; //--- ToDo: Localize;
	x = 16 * GUI_GRID_W + GUI_GRID_X;
	y = 13 * GUI_GRID_H + GUI_GRID_Y;
	w = 5.5 * GUI_GRID_W;
	h = 1.5 * GUI_GRID_H;
};
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT END
////////////////////////////////////////////////////////

};
};



class NPCTradeDialog
{
 idd = 123555;

 movingEnable = false;

 class controlsBackground 
 {
 /*
	class Background: IGUIBack
    {
	idc = 3700;
	x = 0 * safezoneW + safezoneX;
	y = 0 * safezoneH + safezoneY;
	w = 1 * safezoneW;
	h = 1 * safezoneH;
	moving = false;
	
	colorBackground[] = {0,1,0,1};
	
    };
	*/
 };
	
 class objects 
 {
 };
	
	
class controls 
{

////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT START (by GC, v1.063, #Fifemy)
////////////////////////////////////////////////////////

class PlayerItems: RscControlsGroup
{
	idc = 2300;
	x = 0 * GUI_GRID_W + GUI_GRID_X;
	y = 3 * GUI_GRID_H + GUI_GRID_Y;
	w = 19 * GUI_GRID_W;
	h = 19 * GUI_GRID_H;
	class Controls
	{
	};
};
class NPCItems: RscControlsGroup
{
	idc = 2301;
	x = 21 * GUI_GRID_W + GUI_GRID_X;
	y = 3 * GUI_GRID_H + GUI_GRID_Y;
	w = 19 * GUI_GRID_W;
	h = 19 * GUI_GRID_H;
	class Controls
	{
	};
};
class RscButton_1600: RscButton
{
	action = "call endTrade";

	idc = 1600;
	text = "Close"; //--- ToDo: Localize;
	x = 8.18 * GUI_GRID_W + GUI_GRID_X;
	y = 26.05 * GUI_GRID_H + GUI_GRID_Y;
	w = 5 * GUI_GRID_W;
	h = 2 * GUI_GRID_H;
};
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT END
////////////////////////////////////////////////////////

};

};

 

In init.sqf I have this:

 

createDialog "NPCTradeDialog";

 

Then when user clicks a button this code is called:

 

 _display = findDisplay NPCTRADEDLG;
 _display createDisplay "TradeAmountDlg";

which results in "NPCTradeDialog" becoming hidded while "TradeAmountDlg" is visible.

  • Like 1

Share this post


Link to post
Share on other sites

@code34 not French, thanks!

Share this post


Link to post
Share on other sites

I read code34's article but it did not answer my question.

Share this post


Link to post
Share on other sites

Make your second dialog into a ctrlsGroup in your first instead, then use ctrlShow or ctrlSetPosition to hide/show when needed.

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, Larrow said:

Make your second dialog into a ctrlsGroup of your first instead, then use ctrlShow or ctrlSetPosition to hide/show when needed.

 

That's a nice idea but then the user is able to click the buttons of the first dialog and that would be bad...

Share this post


Link to post
Share on other sites
1 minute ago, gc8 said:

 

That's a nice idea but then the user is able to click the buttons of the first dialog and that would be bad...

 

Also create a full screen rscPicture, maybe with a slight faded effect (#(rgb,8,8,3)color(1,1,1,0.2)) like what you get in the editor when bringing up an objects attributes window. This will stop the user being able to interact with the controls below it, but still able to see them.

Share this post


Link to post
Share on other sites
17 minutes ago, Larrow said:

 

Also create a full screen rscPicture, maybe with a slight faded effect (#(rgb,8,8,3)color(1,1,1,0.2)) like what you get in the editor when bringing up an objects attributes window. This will stop the user being able to interact with the controls below it, but still able to see them.

 

That's really nice idea but the clicks seem to through the RscPicture control I put there. And when click hits one of the controls the control becomes top most.

Share this post


Link to post
Share on other sites
1 hour ago, gc8 said:

 

That's a nice idea but then the user is able to click the buttons of the first dialog and that would be bad...

You can do what you want, adding a variable to enable or not the buttons on the first display. You should have all your display/ctrl in rscTitles then each depending controls (background, buttons, texts and tips,..) in a same display. Perhaps a view of what you really want to do could help.

Share this post


Link to post
Share on other sites

Thanks for the replies everyone, I think I got it working now... I had to use ctrlSetFocus on the background control so that the clicks wont go through. Thanks Larrow for the solution!

 

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

×