Jump to content

Show/Hide Image (Visible)


Zuher Laith

Recommended Posts

Hello Everyone

Few days ago i was creating a new design in "guieditor", I Didn't used the MTA Default Window,

I Used an Image (Window Style)

So The Problem Is, When I Bindkey, I Get Nothing Showing Up!

Here's my Code:

local Key = "F10" 
BindKeyFunc = function () 
    guiSetVisible(Project.Background ,not guiGetVisible(Project.Background)); 
    showCursor(guiGetVisible(Project.Background)); 
end 
bindKey(Key,"down",BindKeyFunc); 
  
-- Here is the ID's: 
Project.Background = guiCreateStaticImage((screenW - 357) / 2, (screenH - 304) / 2, 357, 304, "img.png", false) 
Project.WindowTittle = guiCreateLabel(87, 0, 183, 20, "Main", false, Project.Background) 

Here is The Meta:

  <file src="img.png" /> 

am I Missing Something Here ?..

Waiting for Reply.

Link to comment

Yea, but what's the problem? The BindkeyFunc looks correctly, I don't see any errors in it. Insert outputChatBox function in it and check if it's running, like that

local Key = "F10" 
BindKeyFunc = function () 
    outputChatBox("test"); 
    guiSetVisible(Project.Background ,not guiGetVisible(Project.Background)); 
    showCursor(guiGetVisible(Project.Background)); 
end 
bindKey(Key,"down",BindKeyFunc); 

And check if 'test' message shows up on chat.

Link to comment
Yea, but what's the problem? The BindkeyFunc looks correctly, I don't see any errors in it. Insert outputChatBox function in it and check if it's running, like that
local Key = "F10" 
BindKeyFunc = function () 
    outputChatBox("test"); 
    guiSetVisible(Project.Background ,not guiGetVisible(Project.Background)); 
    showCursor(guiGetVisible(Project.Background)); 
end 
bindKey(Key,"down",BindKeyFunc); 

And check if 'test' message shows up on chat.

Problem Sloved.

My Bad :mrgreen:

because i forgot to Change "Project.Background" to my Mod Name ..

That's make me stupid actually :lol:

Thank's Everyone for help!

Link to comment

Hi Again ..

I had the same problem , but with another mod

So The Image Doesn't hide ..

here is the code:

  
local screenWidthh, screenHeightt =     guiGetScreenSize() 
local windowWidthh, windowHeightt =     120, 201 
local leftt =                           screenWidthh/3.5 - windowWidthh/3.5 
local topp =                            screenHeightt/1 - windowHeightt/1 
  
  
mywind[13] = guiCreateStaticImage(leftt,topp, windowWidthh,windowHeightt,"img/s1.png",false) 
  
guiSetAlpha(mywind[13],0.89999997615814) 
  
mywind[5] = guiCreateGridList(10, 10, 100, 113, false, mywind[13]) 
guiGridListSetSelectionMode(mywind[5],2) 
local column = guiGridListAddColumn(mywind[5], "Players", 0.60) 
  
  
row1 = guiGridListAddRow(mywind[5]) 
row2 = guiGridListAddRow(mywind[5]) 
row3 = guiGridListAddRow(mywind[5]) 
row4 = guiGridListAddRow(mywind[5]) 
row5 = guiGridListAddRow(mywind[5]) 
row6 = guiGridListAddRow(mywind[5]) 
  
  
guiGridListSetItemText(mywind[5],row1,column,"1 min", false, false) 
guiGridListSetItemColor ( mywind[5], row1, column, 0, 0, 255 ) 
guiGridListSetItemText(mywind[5],row2,column,"2 min", false, false) 
guiGridListSetItemColor ( mywind[5], row2, column, 0, 0, 255 ) 
guiGridListSetItemText(mywind[5],row3,column,"3 min", false, false) 
guiGridListSetItemColor ( mywind[5], row3, column, 0, 0, 255 ) 
guiGridListSetItemText(mywind[5],row4,column,"4 min", false, false) 
guiGridListSetItemColor ( mywind[5], row4, column, 0, 0, 255 ) 
guiGridListSetItemText(mywind[5],row5,column,"5 min", false, false) 
guiGridListSetItemColor ( mywind[5], row5, column, 0, 0, 255 ) 
guiGridListSetItemText(mywind[5],row6,column,"1 hour", false, false) 
guiGridListSetItemColor ( mywind[5], row6, column, 0, 0, 255 ) 
  
mywind[6] = guiCreateButton(10, 165, 100, 26, "Cancel", false, mywind[13]) 
mywind[8] = guiCreateButton(10, 130, 100, 26, "Throw", false, mywind[13]) 
  
for k,v in ipairs(mywind) do 
 guiSetVisible(v,false) 
end 

So the Point is , i don't have a problem with binding

The Only Problem is when i start the mod , the Background "mywind[13]" be visible , but the children of "mywind[13]" are hidden , and when i bindkey , The Children of "mywind[13]" Show's up normally!

So , might be not the right line ?

waiting for reply ..

Link to comment
Is that all the code? try to re-check the table and guiSetVisible things.
------------------- 
--Key For Open Panel 
------------------- 
local key = "O" 
  
--------------------- 
--Key to Open Panel 
--------------------- 
  
open = false 
bindKey ( key, "down", 
function ( ) 
if open == false then 
add() 
for k,v in ipairs(mywind) do 
 guiSetVisible(v,true) 
end 
showCursor(true) 
open = true 
else 
close() 
    end 
end 
) 
  
--------------------- 
--Close Panel 
--------------------- 
  
function close() 
for k,v in ipairs(mywind) do 
 guiSetVisible(v,false) 
end 
showCursor(false) 
open = false 
setCameraTarget ( getLocalPlayer() ) 
end 

The Object if Window is "mywind[13]" ..

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