Jump to content

Close Button for a GUI Window


Koella

Recommended Posts

Posted

Hello ;)

I am creating a GUI at the moment, but I kinda don't want to add a big close button. I'd much rather have a little "x" at the top right corner.

I've tried achieving that with the property "CloseButtonEnabled", but it didn't work for me. :(

Any ideas how I could still get the "x"-button, even if the property doesn't work accordingly? Or does the property work and I'm just not using it correctly? :o

I'm using the function like this:

guiSetProperty(wdwGUIWindow, CloseButtonEnabled, true)

Thanks in advance ;)

- Koella

Posted

Yes, but to use that I would need to create an own "close" button, which I would not be able to place in the top right corner of the window.

And I'd love to not have a big "close" button in the mid of my GUI window ^^

I'd really prefer having a little "x" somewhere where it doesn't disturb. xP

Posted

Well that's not really an useful comment...

I wouldn't have posted in here if I could find something in the wiki... Searched it long enough :/

Posted
addEventHandler('onClientGUIClick' , root, 
function ( ) 
if ( source == 'ButtonName'  ) then 
guiSetVisible (windoName , false) --- to hid = false show = true 
...... 

Posted

I don't really understand what do you mean, with that event and function, you can do it, the text you used in the button doesn't matter ( "X", "close", etc ).

Posted

Do you mean somethink like that?

  
GUIEditor = { 
    button = {}, 
    window = {} 
} 
GUIEditor.window[1] = guiCreateWindow(174, 135, 490, 299, "", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
    guiSetVisible(GUIEditor.window[1], false) 
  
GUIEditor.button[1] = guiCreateButton(449, 29, 27, 35, "X", false, GUIEditor.window[1]) 
  
function hidegui() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor ( false ) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], hidegui, false ) 
  

Posted

Thanks for your reply Max+, you actually helped us fix another little bug we had with our GUI ;)

We think we also have a solution for the initial problem, we will test it out, and I will edit the results into this post if it works out ^^

Thanks again for all your replies, guys xP

Posted
Do you mean somethink like that?
  
GUIEditor = { 
    button = {}, 
    window = {} 
} 
GUIEditor.window[1] = guiCreateWindow(174, 135, 490, 299, "", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
    guiSetVisible(GUIEditor.window[1], false) 
  
GUIEditor.button[1] = guiCreateButton(449, 29, 27, 35, "X", false, GUIEditor.window[1]) 
  
function hidegui() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor ( false ) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], hidegui, false ) 
  

Yes, that'll work.

Posted

We looked at the code of the GUIEditor resource and looked at how they got the button in their window titlebar.

Afterwards we were able to make our own little "Close" button in the titlebar, at the top right corner of the window ;)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...