Jump to content

Checkbox/Scrollbar


srslyyyy

Recommended Posts

  • Scripting Moderators

Hey.

I have encountered two problems on my way.

1. Checkboxes doesn't trigger (if i set parent to nil everything works normal)

local userPanel = guiCreateWindow(0, 0.70, 0.30, 0.30, "User panel", true)
local guiPanel = {}
local guiPanelTexts = {}
guiPanel[1] = guiCreateCheckBox(0.65, 0.1, 10, 10, "Show HUD", true, true, userPanel)
guiPanel[2] = guiCreateCheckBox(0.65, 0.3, 100, 100, "Show GPS", true, true, userPanel)
guiPanel[2] = guiCreateCheckBox(0.65, 0.5, 100, 100, "Show Debug", true, true, userPanel)
guiPanel[3] = guiCreateCheckBox(0.65, 0.7, 100, 100, "Low blood effect", true, true, userPanel)
guiPanel[4] = guiCreateScrollBar(0.02, 0.3, 0.60, 0.070, true, true, userPanel)
guiPanel[5] = guiCreateScrollBar(0.02, 0.5, 0.60, 0.070, true, true, userPanel)
guiPanel[6] = guiCreateScrollBar(0.02, 0.7, 0.60, 0.070, true, true, userPanel)

guiPanelTexts[1] = guiCreateLabel(0.14, 0.23, 30, 30, "Weapon sounds", true, userPanel)
guiPanelTexts[2] = guiCreateLabel(0.54, 0.23, 30, 30, "100%", true, userPanel)
guiPanelTexts[3] = guiCreateLabel(0.14, 0.43, 30, 30, "Actions sounds", true, userPanel)
guiPanelTexts[4] = guiCreateLabel(0.54, 0.43, 30, 30, "100%", true, userPanel)
guiPanelTexts[5] = guiCreateLabel(0.14, 0.63, 30, 30, "Radio sounds", true, userPanel)
guiPanelTexts[6] = guiCreateLabel(0.54, 0.63, 30, 30, "100%", true, userPanel)

 

2. Scrollbar freeze after loading data from JSON file.

guiSetText(guiPanelTexts[2], playerData.playerSettings.settings[5].."%")
guiScrollBarSetScrollPosition(guiPanel[4], tonumber(playerData.playerSettings.settings[5]))

guiSetText(guiPanelTexts[4], playerData.playerSettings.settings[6].."%")
guiScrollBarSetScrollPosition(guiPanel[5], tonumber(playerData.playerSettings.settings[6]))

guiSetText(guiPanelTexts[6], playerData.playerSettings.settings[7].."%")
guiScrollBarSetScrollPosition(guiPanel[6], tonumber(playerData.playerSettings.settings[7]))

 

Value of scrollbar is correct however, i can't use it. I need to click this to unfreeze it.

taSnTAr.png

Link to comment
  • Moderators

1. Try to attach the checkboxes later than the scrollbar.

 

1. + 2.

The scroll bar is on top of the checkboxes. And the checkboxes might be on top of the scrollbar.

Which focusing on an element, the order might change.

 

This is incorrect: (main issue)

guiPanel[1] = guiCreateCheckBox(0.65, 0.1, 10, 10, "Show HUD", true, true, userPanel)

guiPanel[2] = guiCreateCheckBox(0.65, 0.3, 100, 100, "Show GPS", true, true, userPanel)

guiPanel[2] = guiCreateCheckBox(0.65, 0.5, 100, 100, "Show Debug", true, true, userPanel)

guiPanel[3] = guiCreateCheckBox(0.65, 0.7, 100, 100, "Low blood effect", true, true, userPanel)

guiPanel[4] = guiCreateScrollBar(0.02, 0.3, 0.60, 0.070, true, true, userPanel)

guiPanel[5] = guiCreateScrollBar(0.02, 0.5, 0.60, 0.070, true, true, userPanel)

guiPanel[6] = guiCreateScrollBar(0.02, 0.7, 0.60, 0.070, true, true, userPanel)

 

guiPanelTexts[1] = guiCreateLabel(0.14, 0.23, 30, 30, "Weapon sounds", true, userPanel)

guiPanelTexts[2] = guiCreateLabel(0.54, 0.23, 30, 30, "100%", true, userPanel)

guiPanelTexts[3] = guiCreateLabel(0.14, 0.43, 30, 30, "Actions sounds", true, userPanel)

guiPanelTexts[4] = guiCreateLabel(0.54, 0.43, 30, 30, "100%", true, userPanel)

guiPanelTexts[5] = guiCreateLabel(0.14, 0.63, 30, 30, "Radio sounds", true, userPanel)

guiPanelTexts[6] = guiCreateLabel(0.54, 0.63, 30, 30, "100%", true, userPanel)

 

30 = 3000%

100 = 10000%

@majqq = 100000000%

 

Edited by IIYAMA
  • Like 1
  • Thanks 1
Link to comment
  • Scripting Moderators
13 minutes ago, IIYAMA said:

1. Try to attach the checkboxes later than the scrollbar.

 

1. + 2.

The scroll bar is on top of the checkboxes. And the checkboxes might be on top of the scrollbar.

This is incorrect: (main issue)

guiPanel[1] = guiCreateCheckBox(0.65, 0.1, 10, 10, "Show HUD", true, true, userPanel)

guiPanel[2] = guiCreateCheckBox(0.65, 0.3, 100, 100, "Show GPS", true, true, userPanel)

guiPanel[2] = guiCreateCheckBox(0.65, 0.5, 100, 100, "Show Debug", true, true, userPanel)

guiPanel[3] = guiCreateCheckBox(0.65, 0.7, 100, 100, "Low blood effect", true, true, userPanel)

guiPanel[4] = guiCreateScrollBar(0.02, 0.3, 0.60, 0.070, true, true, userPanel)

guiPanel[5] = guiCreateScrollBar(0.02, 0.5, 0.60, 0.070, true, true, userPanel)

guiPanel[6] = guiCreateScrollBar(0.02, 0.7, 0.60, 0.070, true, true, userPanel)

 

guiPanelTexts[1] = guiCreateLabel(0.14, 0.23, 30, 30, "Weapon sounds", true, userPanel)

guiPanelTexts[2] = guiCreateLabel(0.54, 0.23, 30, 30, "100%", true, userPanel)

guiPanelTexts[3] = guiCreateLabel(0.14, 0.43, 30, 30, "Actions sounds", true, userPanel)

guiPanelTexts[4] = guiCreateLabel(0.54, 0.43, 30, 30, "100%", true, userPanel)

guiPanelTexts[5] = guiCreateLabel(0.14, 0.63, 30, 30, "Radio sounds", true, userPanel)

guiPanelTexts[6] = guiCreateLabel(0.54, 0.63, 30, 30, "100%", true, userPanel)

 

30 = 300%

100 = 1000%

@majqq = 100000000%

 

 

Oh i didn't noticed that, changed sizes to less and everything works :D

Thank you.

  • Like 1
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...