Loading ...
Sorry, an error occurred while loading the content.

43552Re: [libertybasic] Aligning text and objects

Expand Messages
  • Peter
    Aug 2, 2011
    • 0 Attachment
      If using STATICTEXT then you can use STYLEBITS to center the text make the
      box the same width as the window and hey presto centered text.
      Try this
      Code
      NOMAINWIN
      [Win.Size]
      WindowWidth = DisplayWidth : WindowHeight = DisplayHeight
      [Win.Controls]
      Stylebits #tw.stTitle, _SS_CENTER,0,0,0
      statictext #tw.stTitle, "Title Text Here", 0,25,WindowWidth,25
      [Win.Open]
      open "Test" for window as #tw
      #tw "trapclose [tw.quit]"
      [tw.loop]
      wait
      [tw.quit]
      close #tw
      end

      Peter
      ----- Original Message -----
      From: "William Lopez" <welopez@...>
      To: <libertybasic@yahoogroups.com>
      Sent: Tuesday, August 02, 2011 6:46 PM
      Subject: RE: [libertybasic] Aligning text and objects


      >
      > If you want text printed to the screen when using NOMAINWIN, you must use
      > a textbox, graphicbox, statictext, or texteditor to "contain" the text.
      > You will probably be printing a defined string. Pad the string front and
      > rear with spaces until it is centered, then print the string to the
      > container. NOTE BENE: different fonts will have different character
      > widths. To truly center your text, you need to use a monospaced font,
      > such as Courier New.
      >
      > Bill
      >
      > welopez@...
      >
      > To: libertybasic@yahoogroups.com
      > From: jcoones@...
      > Date: Tue, 2 Aug 2011 17:32:02 +0000
      > Subject: [libertybasic] Aligning text and objects
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      > I purchased LB some time ago but never really got to use it much. I
      > have since retired and now have time to learn how it works.
      >
      >
      >
      > One question I have, which may seem simple, is:
      >
      >
      >
      > when using NOMAINWIN, how do you position text in the display area? In
      > other words, if I have some text that I want centered horizontally on the
      > screen, what is the best way to do this?
      >
      >
      >
      > Thanks,
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
    • Show all 12 messages in this topic