Jump to content

How to make a modal dialog?


'LinKin

Recommended Posts

Hello,

Do you know what a modal dialog is?

- In Java, a modal dialog is the one which does't allow the user to click on the windows form the back.

I want to do this with MTA GUI. I was taking a look at this resource: msgbox. But sadly, that only makes a confirm dialog, and that's not what I need. I need to display a window where the client inputs some text.

In msgbox resource, there's something called forceShowing which is making the window behave like a modal dialog. But there's something that I don't understand... How is it working?

I got this piece of code:

if ( forceShowing ) then 
        cover = guiCreateButton ( 0, 0, 1, 1, "", true ) 
        guiSetAlpha ( cover, 0 ) 
        addEventHandler ( "onClientGUIClick", cover, bringMsgBoxToFront ) 
end 

Is that button occuping the whole screen?

Link to comment
Hello,

Do you know what a modal dialog is?

- In Java, a modal dialog is the one which does't allow the user to click on the windows form the back.

I want to do this with MTA GUI. I was taking a look at this resource: msgbox. But sadly, that only makes a confirm dialog, and that's not what I need. I need to display a window where the client inputs some text.

In msgbox resource, there's something called forceShowing which is making the window behave like a modal dialog. But there's something that I don't understand... How is it working?

I got this piece of code:

if ( forceShowing ) then 
        cover = guiCreateButton ( 0, 0, 1, 1, "", true ) 
        guiSetAlpha ( cover, 0 ) 
        addEventHandler ( "onClientGUIClick", cover, bringMsgBoxToFront ) 
end 

Is that button occuping the whole screen?

Correct me if I'm wrong but it is a dialogBox, showing a 'loading', or a message whenever you're doing something in the background of another thread. right?

To actually do this, you can achieve this by creating a small new window with the required things on it and toggle its visibility. I'm just not quite sure how to make it unable to click back to the other one. you can disable the onClientClick when the dialog is active, maybe that's a thing ( cancelEvent() ).

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