ViCe Posted January 13, 2011 Share Posted January 13, 2011 Hi all I made a new GUI window and i want to make a bindkey ex: F1 to show/hide the GUI window. ------------------------------------- -- Code generated by DKR QT to Lua 0.1.6 -- -- Source: welcomeca.ui -- -- Date: 13/01/2011 - 14:27:20 -- ------------------------------------- function build_Dialog() local gui = {} gui._placeHolders = {} local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 400, 315 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 gui["_root"] = guiCreateWindow(left, top, windowWidth, windowHeight, "Dialog", false) guiWindowSetSizable(gui["_root"], false) gui[""] = guiCreateButton(231, 287, 77, 28, "OK", false, gui["_root"]) if on__clicked then addEventHandler("onClientGUIClick", gui[""], on__clicked, false) end gui[""] = guiCreateButton(314, 287, 77, 28, "Cancel", false, gui["_root"]) if on__clicked then addEventHandler("onClientGUIClick", gui[""], on__clicked, false) end gui["tabWidget"] = guiCreateTabPanel(0, 15, 391, 271, false, gui["_root"]) gui["tab"] = guiCreateTab("Tab 1", gui["tabWidget"]) gui["checkBox"] = guiCreateCheckBox(0, 230, 221, 18, "Don't show this window again", false, false, gui["tab"]) gui._placeHolders["textEdit"] = {left = 0, top = 0, width = 391, height = 231, parent = gui["tab"]} gui[""] = guiCreateScrollBar(0, 0, 100, 30,true, false, gui["tab"]) gui[""] = guiCreateScrollBar(0, 0, 100, 30,false, false, gui["tab"]) gui["tab_2"] = guiCreateTab("Tab 2", gui["tabWidget"]) gui["checkBox_2"] = guiCreateCheckBox(0, 230, 111, 18, "I accept the rules!", false, false, gui["tab_2"]) gui._placeHolders["textEdit_2"] = {left = 0, top = 0, width = 391, height = 221, parent = gui["tab_2"]} gui[""] = guiCreateScrollBar(0, 0, 100, 30,true, false, gui["tab_2"]) gui[""] = guiCreateScrollBar(0, 0, 100, 30,false, false, gui["tab_2"]) return gui, windowWidth, windowHeight end function on__clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here end function on__clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here end -- End of DKR QT to Lua code -- Please someone help me with it Thanks. Link to comment
SDK Posted January 13, 2011 Share Posted January 13, 2011 First take a look at the guitest.zip resource if you don't know what you're doing (the command code is in guitest.lua): http://dkrclan.com/?p=qttolua&large#downloads And where the commandhandler is, you can add a bindkey function. Link to comment
Castillo Posted January 13, 2011 Share Posted January 13, 2011 ------------------------------------- -- Code generated by DKR QT to Lua 0.1.6 -- -- Source: welcomeca.ui -- -- Date: 13/01/2011 - 14:27:20 -- ------------------------------------- function build_Dialog() local gui = {} gui._placeHolders = {} local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 400, 315 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 gui["_root"] = guiCreateWindow(left, top, windowWidth, windowHeight, "Dialog", false) guiWindowSetSizable(gui["_root"], false) gui[""] = guiCreateButton(231, 287, 77, 28, "OK", false, gui["_root"]) if on__clicked then addEventHandler("onClientGUIClick", gui[""], on__clicked, false) end gui[""] = guiCreateButton(314, 287, 77, 28, "Cancel", false, gui["_root"]) if on__clicked then addEventHandler("onClientGUIClick", gui[""], on__clicked, false) end gui["tabWidget"] = guiCreateTabPanel(0, 15, 391, 271, false, gui["_root"]) gui["tab"] = guiCreateTab("Tab 1", gui["tabWidget"]) gui["checkBox"] = guiCreateCheckBox(0, 230, 221, 18, "Don't show this window again", false, false, gui["tab"]) gui._placeHolders["textEdit"] = {left = 0, top = 0, width = 391, height = 231, parent = gui["tab"]} gui[""] = guiCreateScrollBar(0, 0, 100, 30,true, false, gui["tab"]) gui[""] = guiCreateScrollBar(0, 0, 100, 30,false, false, gui["tab"]) gui["tab_2"] = guiCreateTab("Tab 2", gui["tabWidget"]) gui["checkBox_2"] = guiCreateCheckBox(0, 230, 111, 18, "I accept the rules!", false, false, gui["tab_2"]) gui._placeHolders["textEdit_2"] = {left = 0, top = 0, width = 391, height = 221, parent = gui["tab_2"]} gui[""] = guiCreateScrollBar(0, 0, 100, 30,true, false, gui["tab_2"]) gui[""] = guiCreateScrollBar(0, 0, 100, 30,false, false, gui["tab_2"]) return gui, windowWidth, windowHeight end function on__clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here end function on__clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end --TODO: Implement your button click handler here end -- End of DKR QT to Lua code -- local gui = nil function guiShowHide() if not gui or not guiGetVisible(gui._root) then show() else hide() end end bindKey("F1","down",guiShowHide) function show() if not gui then gui = build_Dialog() else guiSetVisible(gui._root, true) end showCursor(true) end function hide() if not gui then return end guiSetVisible(gui._root, false) showCursor(false) end Link to comment
ViCe Posted January 13, 2011 Author Share Posted January 13, 2011 Thankks too much =D 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