Jump to content

tabPanel hides the last tab depending on resolution


Recommended Posts

Now this is weird, because i'm using relative window, relative tabPanel, relative everything, the size of the GUI window is always the same for all resolutions though, centered, not bigger or smaller than usual. However, only the tab is messed up.

Notice the last tab "Permanent" isn't showing for a player with lower resolution.

    tabWidth, tabHeight = 0.32, 0.25 
    tCenterX, tCenterY = (1 / 2) - (tabWidth / 2), (1 / 2) - (tabHeight / 2) 
    tabPanel = guiCreateTabPanel(tCenterX, tCenterY+0.355, tabWidth, tabHeight, true, window) 
    monthsTab = guiCreateTab("Months", tabPanel) 
    daysTab = guiCreateTab("Days", tabPanel) 
    hoursTab = guiCreateTab("Hours", tabPanel) 
    minutesTab = guiCreateTab("Minutes", tabPanel) 
    permTab = guiCreateTab("Permanent", tabPanel) 
  

Notice i set the sorting to false, its really bugged, after sorting few times, reopening gridlist shows empty cells, but that's another problem, if anyone is aware of it, please leave a comment.

aHluAtK.png

kilengl.jpg

Edited by Guest
Link to comment
  • Moderators

If you are trying to change the size of the grid list tab according to the resolution, then leave it with the original size and change only the X and Y positions. I'm not sure of what can be though, since the only code you posted is about gridlist.

Link to comment
  • Moderators

Well, the tab panel has a parent element which is a window. In this case, try positioning the tab panel without adjusting their positions.

Look at the code of the tab and see if there's nothing wrong with it, by comparing with other gui-elements in the window - something should be wrong since it happens only to the tab panel.

Link to comment
Well, the tab panel has a parent element which is a window. In this case, try positioning the tab panel without adjusting their positions.

Look at the code of the tab and see if there's nothing wrong with it, by comparing with other gui-elements in the window - something should be wrong since it happens only to the tab panel.

You lost me there.

Here is the complete code for creating window and tabpanel.

local guiWidth, guiHeight, centerX, centerY, tCenterX, tCenterY, tabWidth, tabHeight = 0 
local tabPanel, monthsTab, daysTab, hoursTab, minutesTab, permTab = nil 
local window = nil 
  
  
function GUI() 
    guiWidth, guiHeight = 0.6, 0.6 
    centerX, centerY = (1 / 2) - (guiWidth / 2), (1 / 2) - (guiHeight / 2) 
  
    tabWidth, tabHeight = 0.32, 0.25 
    tCenterX, tCenterY = (1 / 2) - (tabWidth / 2), (1 / 2) - (tabHeight / 2) 
  
    window = guiCreateWindow( centerX, centerY, guiWidth, guiHeight, "Alias System", true) 
    guiWindowSetSizable (window, false) 
  
    tabPanel = guiCreateTabPanel(tCenterX, tCenterY+0.355, tabWidth, tabHeight, true, window) 
    monthsTab = guiCreateTab("Months", tabPanel) 
    daysTab = guiCreateTab("Days", tabPanel) 
    hoursTab = guiCreateTab("Hours", tabPanel) 
    minutesTab = guiCreateTab("Minutes", tabPanel) 
    permTab = guiCreateTab("Permanent", tabPanel) 
  
    guiSetVisible(window, false) 
end 
addEventHandler("onClientResourceStart", resourceRoot, GUI) 

Btw, is adding all variables above as local defining their initial state is healthy for MTA? there is this counter i defined to local counter = 0, it didn't work, after removing the local keyword it worked, even though its not inside a function.

Link to comment

From what I see you've a problem with the text in the tabs, they're too big to fit in the smaller resolutions.

The only way to fix this issue is by editing the text in the tab and making its font smaller, which obviously you can't in MTA.

I suggest using short forms, for e.g: "Mo", "D", "H", "Min", "P" instead of full-words.

Link to comment
  • Moderators

You don't have to define locally the variable of each gui-element created.

You can do this way:

local guiWidth, guiHeight = 0.6, 0.6 
local tabWidth, tabHeight = 0.32, 0.25 
local centerX, centerY = .5 - (guiWidth / 2), .5 - (guiHeight / 2) 
local tCenterX, tCenterY = .5 - (tabWidth / 2), .5 - (tabHeight / 2) 

About your issue, I don't think the text length of the tab is causing this problem (even though I may be wrong).

My guess is that your code is adjusting the interface to fit in all resolutions and causing this.

I wasn't able to realize this, by looking at the code you posted, though. Try changing positions from relative to absolute and see if it works.

If the problem persists, post here the entire code (or send me via PM).

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