yMassai Posted April 24, 2012 Share Posted April 24, 2012 Hi how are you? I need a little help basic ,do not know very well create windows. In this example I created a window with a button and a place for text. In this text players can edit what is written, I want this to be intact, ie no one can remove what is written in place of text. infoWindow = guiCreateWindow(350,250,450,320,"Painel Info",false) guiCreateButton(15,40,105,35,"Regras",false,infoWindow) guiCreateMemo(135,40,300,260,"Test text",false,infoWindow) guiWindowSetSizable(infoWindow,false) guiSetVisible( infoWindow, false ) function infoShow () guiSetVisible( infoWindow, not guiGetVisible( infoWindow ) ) showCursor( not isCursorShowing( ) ) end bindKey ("F1", "down", infoShow ) Link to comment
iFoReX Posted April 24, 2012 Share Posted April 24, 2012 try it infoWindow = guiCreateWindow(350,250,450,320,"Painel Info",false) guiCreateButton(15,40,105,35,"Regras",false,infoWindow) memo = guiCreateMemo(135,40,300,260,"Test text",false,infoWindow) guiMemoSetReadOnly( memo, true ) guiWindowSetSizable(infoWindow,false) guiSetVisible( infoWindow, false ) function infoShow () guiSetVisible( infoWindow, not guiGetVisible( infoWindow ) ) showCursor( not isCursorShowing( ) ) end bindKey ("F1", "down", infoShow ) Link to comment
Castillo Posted April 24, 2012 Share Posted April 24, 2012 You want to set the memo read-only? if so, use the function: guiMemoSetReadOnly. Link to comment
yMassai Posted April 24, 2012 Author Share Posted April 24, 2012 Here again i this time I would like another helping hand. as we see there are two buttons and two texts. I would like to open for example: I want the text arises "Memo1" when tightening "Regras", and also that when I push the button "Infor", the text "Memo2" to emerge in place of text "Memo1". infoWindow = guiCreateWindow(350,250,450,320,"Painel Info",false) guiCreateButton(15,40,105,35,"Regras",false,infoWindow) memo1 = guiCreateMemo(135,40,300,260,"Test text",false,infoWindow) guiMemoSetReadOnly( memo1, true ) guiWindowSetSizable(infoWindow,false) guiSetVisible( infoWindow, false ) function infoShow () guiSetVisible( infoWindow, not guiGetVisible( infoWindow ) ) showCursor( not isCursorShowing( ) ) end bindKey ("F1", "down", infoShow ) guiCreateButton(15,80,105,35,"Infor",false,infoWindow) memo2 = guiCreateMemo(135,40,300,260,"Test text",false,infoWindow) guiMemoSetReadOnly( memo2, true ) Link to comment
iFoReX Posted April 24, 2012 Share Posted April 24, 2012 mmm try it infoWindow = guiCreateWindow(350,250,450,320,"Painel Info",false) guiCreateButton(15,40,105,35,"Regras",false,infoWindow) memo1 = guiCreateMemo(135,40,300,260,"Test text",false,infoWindow) guiMemoSetReadOnly( memo1, true ) guiWindowSetSizable(infoWindow,false) guiSetVisible( infoWindow, false ) -------------------------------------------------------- button = guiCreateButton(15,80,105,35,"Infor",false,infoWindow) memo2 = guiCreateMemo(135,40,300,260,"Test text",false,infoWindow) guiMemoSetReadOnly( memo2, true ) function infoShow () guiSetVisible( infoWindow, not guiGetVisible( infoWindow ) ) showCursor( not isCursorShowing( ) ) end bindKey ("F1", "down", infoShow ) addEventHandler("onClientGUIClick", root, function() if source == button then guiSetText( memo2, " guiGetText( memo1 ) " end end ) if doesnt work please tell me Link to comment
yMassai Posted April 24, 2012 Author Share Posted April 24, 2012 the window does not open Link to comment
Castillo Posted April 24, 2012 Share Posted April 24, 2012 infoWindow = guiCreateWindow(350,250,450,320,"Painel Info",false) guiCreateButton(15,40,105,35,"Regras",false,infoWindow) memo1 = guiCreateMemo(135,40,300,260,"Test text",false,infoWindow) guiMemoSetReadOnly( memo1, true ) guiWindowSetSizable(infoWindow,false) guiSetVisible( infoWindow, false ) -------------------------------------------------------- button = guiCreateButton(15,80,105,35,"Infor",false,infoWindow) memo2 = guiCreateMemo(135,40,300,260,"Test text",false,infoWindow) guiMemoSetReadOnly( memo2, true ) function infoShow ( ) guiSetVisible ( infoWindow, not guiGetVisible ( infoWindow ) ) showCursor ( not isCursorShowing( ) ) end bindKey ( "F1", "down", infoShow ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == button ) then guiSetText ( memo1, guiGetText( memo2 ) ) end end ) Link to comment
yMassai Posted April 24, 2012 Author Share Posted April 24, 2012 Now the window appears. but to push the button nothing happens. Link to comment
Castillo Posted April 24, 2012 Share Posted April 24, 2012 When you click on "Infor" it'll set the text of "memo1" with the text of "memo2", both text's are the same, so you won't notice it changed. Link to comment
yMassai Posted April 24, 2012 Author Share Posted April 24, 2012 infoWindow = guiCreateWindow(350,250,450,320,"Painel Info",false) guiCreateButton(15,40,105,35,"Regras",false,infoWindow) memo1 = guiCreateMemo(135,40,300,260,"Test text 11111111",false,infoWindow) guiMemoSetReadOnly( memo1, true ) guiWindowSetSizable(infoWindow,false) guiSetVisible( infoWindow, false ) -------------------------------------------------------- button = guiCreateButton(15,80,105,35,"Infor",false,infoWindow) memo2 = guiCreateMemo(135,40,300,260,"Test text 2222222",false,infoWindow) guiMemoSetReadOnly( memo2, true ) function infoShow ( ) guiSetVisible ( infoWindow, not guiGetVisible ( infoWindow ) ) showCursor ( not isCursorShowing( ) ) end bindKey ( "F1", "down", infoShow ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == button ) then guiSetText ( memo1, guiGetText( memo2 ) ) end end ) Dont work. Link to comment
yMassai Posted April 24, 2012 Author Share Posted April 24, 2012 window appears, but no exchange the "memo" Link to comment
iFoReX Posted April 24, 2012 Share Posted April 24, 2012 I test ur GUI in my server and it is better infoWindow = guiCreateWindow(350,250,450,320,"Painel Info",false) button = guiCreateButton(15,40,105,35,"Regras",false,infoWindow) memo1 = guiCreateMemo(135,40,300,260,"text",false,infoWindow) guiMemoSetReadOnly( memo1, true ) guiWindowSetSizable(infoWindow,false) guiSetVisible( infoWindow, false ) -------------------------------------------------------- button = guiCreateButton(15,80,105,35,"Infor",false,infoWindow) memo2 = guiCreateMemo(135,40,300,260,"text",false,infoWindow) guiMemoSetReadOnly( memo2, true ) function infoShow ( ) guiSetVisible ( infoWindow, not guiGetVisible ( infoWindow ) ) showCursor ( not isCursorShowing( ) ) end bindKey ( "F1","down", infoShow ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == button ) then guiSetVisible( memo2, true ) guiSetVisible( memo1, false ) elseif ( source == button2 ) then guiSetVisible( memo1, true ) guiSetVisible( memo2, false ) end end ) - I think u have a error in memo1 doesnt create only the memo2 EDIT SORY MY ERROR XDD now it code work 100% infoWindow = guiCreateWindow(350,250,450,320,"Painel Info",false) button = guiCreateButton(15,40,105,35,"Regras",false,infoWindow) memo1 = guiCreateMemo(135,40,300,260,"text1",false,infoWindow) guiMemoSetReadOnly( memo1, true ) guiWindowSetSizable(infoWindow,false) guiSetVisible( infoWindow, false ) -------------------------------------------------------- button2 = guiCreateButton(15,80,105,35,"Infor",false,infoWindow) memo2 = guiCreateMemo(135,40,300,260,"text2",false,infoWindow) guiMemoSetReadOnly( memo2, true ) function infoShow ( ) guiSetVisible ( infoWindow, not guiGetVisible ( infoWindow ) ) showCursor ( not isCursorShowing( ) ) end bindKey ( "F1","down", infoShow ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == button ) then guiSetVisible( memo2, true ) guiSetVisible( memo1, false ) elseif ( source == button2 ) then guiSetVisible( memo1, true ) guiSetVisible( memo2, false ) end end ) Link to comment
yMassai Posted April 24, 2012 Author Share Posted April 24, 2012 infoWindow = guiCreateWindow(350,250,450,320,"Painel Info",false) button = guiCreateButton(15,40,105,35,"Regras",false,infoWindow) memo1 = guiCreateMemo(135,40,300,260,"text1",false,infoWindow) guiMemoSetReadOnly( memo1, true ) guiWindowSetSizable(infoWindow,false) guiSetVisible( infoWindow, false ) -------------------------------------------------------- button2 = guiCreateButton(15,80,105,35,"Infor",false,infoWindow) memo2 = guiCreateMemo(135,40,300,260,"text2",false,infoWindow) guiMemoSetReadOnly( memo2, true ) function infoShow ( ) guiSetVisible ( infoWindow, not guiGetVisible ( infoWindow ) ) showCursor ( not isCursorShowing( ) ) end bindKey ( "F1","down", infoShow ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == button2 ) then guiSetVisible( memo2, true ) guiSetVisible( memo1, false ) elseif ( source == button ) then guiSetVisible( memo1, true ) guiSetVisible( memo2, false ) end end ) Work 100% thank you very much Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now