Page 1 of 2

Geyser/Window Layout Question

Posted: Wed Nov 19, 2014 9:32 am
by imany
Is Geyser or any of the other window layout-oriented stuff able to create a margin above the input area so that you can fit a label at the bottom of the screen without it covering pertinent information?

Re: Geyser/Window Layout Question

Posted: Thu Nov 20, 2014 2:45 am
by Akaya
Yes. Use setBorderBottom() to give the margin above the command line. Then place your label appropriately.

Re: Geyser/Window Layout Question

Posted: Fri Nov 21, 2014 2:11 pm
by imany
Okay, another question. I'm having trouble with this:

Code: Select all

local prompt_container = Geyser.HBox:new({
  name = "prompt_container",
  x = "0", y = "-30",
  width = "100%", height = "30",
})

local HP1 = Geyser.Label:new({
  name = "HP1",
  width = "30",
  h_policy = Geyser.Fixed,
  },
  prompt_container)
HP1:echo("HP: ", "green", "c")
HP1:setStyleSheet([[
  font-size: 20px;
  background-color: black;
]])
Where my label is respecting background-color but not font-size. Any idea what the problem is?

Re: Geyser/Window Layout Question

Posted: Fri Nov 21, 2014 4:36 pm
by fetaera
Use the setFontSize() method available with Geyser or simply opt for a full Qt stylesheet.

Re: Geyser/Window Layout Question

Posted: Fri Nov 21, 2014 5:33 pm
by imany
I may be misunderstanding what you mean, but I tried setFontSize() on the container in question and it didn't seem to be inherited by the labels. It also didn't seem to be able to applied directly to the labels themselves. I'm also not quite sure what you mean by a full Qt stylesheet? Is there an alternative method to tacking a stylesheet onto a label?

Re: Geyser/Window Layout Question

Posted: Sun Nov 23, 2014 7:33 am
by Akaya
setFontSize is used for miniconsoles. Not labels.

I personally style my label fonts within my echo's using tags like so:
Code: [show] | [select all] lua
mylabel:echo([[<span style="font-size:20px">My label text</span>]])

Re: Geyser/Window Layout Question

Posted: Wed Nov 26, 2014 12:03 am
by imany
Thanks, that's really helpful!

One more question: Can you use a variable for a color in the <span> tag?

Re: Geyser/Window Layout Question

Posted: Wed Nov 26, 2014 6:30 am
by Akaya
Yes.

Re: Geyser/Window Layout Question

Posted: Wed Jun 03, 2015 10:30 am
by imany
How do you get a variable into a color tag?

Code: Select all

  HP:echo([[<span style="color:#]]..HPcolor..[[;font-size: 11pt">]]..currentHP..[[<span><span style="color:#FFFFFF;font-size: 11pt">/]]..maxHP..[[</span><span style="color:#]]..HPcolor..[[;font-size: 11pt"> ]]..percHP..[[%<span>]])
My problem here is that the " " seem to be overriding the [[ ]], so HPcolor isn't being recognized as a variable but rather being eaten by the whole span tag. How do I fix this?

Re: Geyser/Window Layout Question

Posted: Wed Jun 03, 2015 4:50 pm
by Akaya
You're actually doing it correctly and it should work as is. The color highlighting isn't the greatest in this situation but I tested your snippet and it worked great.

Here's my own snippet in which your echo was successful...
Code: [show] | [select all] lua
HP = Geyser.Label:new({
  name = "HP",
  x = 0,
  y = 0,
  width = 500,
  height = 200,
})

local HPcolor = "FFFF00"
local currentHP = 100
local maxHP = 100
local percHP = 100

HP:echo([[<span style="color:#]]..HPcolor..[[;font-size: 11pt">]]..currentHP..[[<span><span style="color:#FFFFFF;font-size: 11pt">/]]..maxHP..[[</span><span style="color:#]]..HPcolor..[[;font-size: 11pt"> ]]..percHP..[[%<span>]])
I'd make sure that your doing this on a label and that your variables all have values.