Chlorek Posted August 26, 2013 Share Posted August 26, 2013 Hi there. I am scripting some GUI and I found some problems with buttons in tabs. First of all I have to use relative=true when creating button (when I don't I do not see button). However when I used it I found another one problem - whereever I click in the tab the button is activated, but should only if button is clicked - really weird problem. Thanks for help! Link to comment
Moderators IIYAMA Posted August 26, 2013 Moderators Share Posted August 26, 2013 You can better use absolute and calculate for some parts factors, to change it back to relative. Absolute is in pixels. sample: 1920 x 1080 pixels Relative is 0 t/m 1 0 = 0% size 1 = 100% size Link to comment
Chlorek Posted August 26, 2013 Author Share Posted August 26, 2013 No, it's not a problem. Just when I used absolute my button was invisible. When I changed it to relative (0-1) my button is detected whereever I click in the tab. That's the problem. Link to comment
Moderators IIYAMA Posted August 26, 2013 Moderators Share Posted August 26, 2013 The lines you want to improve or fix? else it will be a useless conversation. Link to comment
Chlorek Posted August 27, 2013 Author Share Posted August 27, 2013 local tabs = guiCreateTabPanel(5, 20, width-10, height-25, false, mainWindow) local tabLogin = guiCreateTab("Login", tabs) local tabRegister = guiCreateTab("Register", tabs) local nameStatic = guiCreateLabel((width-60)/2, 5, 60, 20, "Username:", false, tabLogin) local nameEdit = guiCreateEdit((width-200)/2, 25, 200, 25, "", false, tabLogin) guiEditSetMaxLength(nameEdit, 25) --guiSetProperty(nameEdit, "TextFormatting", "HorzCentred") local passwdStatic = guiCreateLabel((width-60)/2, 65, 60, 20, "Password:", false, tabLogin) local passwdEdit = guiCreateEdit((width-200)/2, 83, 200, 25, "", false, tabLogin) guiSetProperty(passwdEdit, "MaskText", "True") guiEditSetMaxLength(passwdEdit, 30) local loginbtn = guiCreateButton(0.1, 0.8, 0.8, 0.1, "Log Me In", true, tabLogin) This is my code, loginbtn is invisible when I set relative to false and use pixels. It happens only when I create button in a tab. And in relative mode my button is clicked when I click wherever in Login tab. My button click event handler (OH, it's register button handler, but they are the same so no matter): unction sendRegisterRequest(button, state) if button == "left" and state == "up" then triggerServerEvent("sendRegisterRequest", getLocalPlayer(), guiGetText(nameEditReg), guiGetText(passwdEditReg), guiGetText(rpasswdEditReg)) end end addEventHandler("onClientGUIClick", registerbtn, sendRegisterRequest) 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