Geyser/Window Layout Question

imany
Posts: 12
Joined: Mon May 16, 2011 7:32 pm

Geyser/Window Layout Question

Post by imany » Wed Nov 19, 2014 9:32 am

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?

User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Geyser/Window Layout Question

Post by Akaya » Thu Nov 20, 2014 2:45 am

Yes. Use setBorderBottom() to give the margin above the command line. Then place your label appropriately.

imany
Posts: 12
Joined: Mon May 16, 2011 7:32 pm

Re: Geyser/Window Layout Question

Post by imany » Fri Nov 21, 2014 2:11 pm

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?

fetaera
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm

Re: Geyser/Window Layout Question

Post by fetaera » Fri Nov 21, 2014 4:36 pm

Use the setFontSize() method available with Geyser or simply opt for a full Qt stylesheet.

imany
Posts: 12
Joined: Mon May 16, 2011 7:32 pm

Re: Geyser/Window Layout Question

Post by imany » Fri Nov 21, 2014 5:33 pm

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?

User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Geyser/Window Layout Question

Post by Akaya » Sun Nov 23, 2014 7:33 am

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>]])

imany
Posts: 12
Joined: Mon May 16, 2011 7:32 pm

Re: Geyser/Window Layout Question

Post by imany » Wed Nov 26, 2014 12:03 am

Thanks, that's really helpful!

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

User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Geyser/Window Layout Question

Post by Akaya » Wed Nov 26, 2014 6:30 am

Yes.

imany
Posts: 12
Joined: Mon May 16, 2011 7:32 pm

Re: Geyser/Window Layout Question

Post by imany » Wed Jun 03, 2015 10:30 am

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?

User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Geyser/Window Layout Question

Post by Akaya » Wed Jun 03, 2015 4:50 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests