Jump to content

Close Button for a GUI Window


Koella

Recommended Posts

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

Link to comment

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

Link to comment

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 ) 
  

Link to comment

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

Link to comment
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.

Link to comment

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 ;)

Link to comment

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...