Skip to content

dancer text #161

@Martinix75

Description

@Martinix75

Hi these days I finally have some time and I am learning to "play" with a figguro.
To start I wrote this, (very simple to understand the mechanisms), but my problem is the centering the text in the green button. Because so I wrote it with the window just created it is in a position, but if the explanation moves where he wants, while I would always like it to the center (with every size) where is I wrong? Is there one way to make it fixed in the center in every situation?

import figuro
import figuro/widgets/button

let typeface = defaultTypeface()
let font = Uifont(typefaceId: typeface, size:18)
type
  Main* = ref object of Figuro
proc initialize*(self: Main) {.slot.} =
  self.setTitle("Test 123 init ")
  
proc draw*(self: Main) {.slot.} =
  #self.setTitle("Test 123 draw")
  withWidget(self):
    this.setName "pippo"
    Rectangle.new "sfondo":
      with this:
        box 0'ux, 0'ux, 100'pp, 100'pp
        fill css"#FF00F0"
      Text.new "scritta":
        with this:
          #box 50'ux, 20'ux, 200'ux, 250'ux
          offset 10'pp, 10'pp
          #justify Center
          text({font: "Ciao"})
      Button.new "b1":
        with this:
          #box 50'ux, 60'ux, 200'ux, 30'ux
          offset 10'pp, 25'pp
          size 10'pp, 15'pp
          fill css "#4caf50"
          cornerRadius 5.0'ux
        Text.new "testob1":
          with this:
            offset 50'pp, 50'pp
            #size 100'pp, 100'pp
            justify Center
            #align Middle
            text({font: "Pippo"})

var main = Main.new()
var frame = newAppFrame(main, size=(700'ui, 240'ui))
startFiguro(frame)

bye by Martin A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions