Text aligne

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
Post Reply
Posts: 30
Joined: Mon 02 Apr 2018, 15:48

Text aligne

Post by roy » Wed 02 May 2018, 17:13

Hi All

When help is called in Windows the text is left aligned. In Android the text is centre aligned. I would like the text to be left aligned in Android the same as in Windows.

Any ideas?

Thanks Roy

Code: Select all

      rem Help box
      local h$, c$, n$ : n$ =  chr$(10) + chr$(13)
      c$ = "Fill Shapes"
      h$ = "Select one of the five Puzzles. The Options button is top right. " + n$ + n$
      h$ += "To play Fill Shapes, fill each area with one of the four colours" + n$
      h$ += "but do not let the same colours touch." + n$ + n$
      h$ += "Tap/click one of the colours in the pallet to fill the shape with the dot in it." + n$ + n$
      h$ += "For a challenge try filling the puzzle with three or less colours, rather than four!" + n$ + n$

      if windows% then
        sys "MessageBox", @hwnd%, h$, c$, 0
        sys "SDL_ShowSimpleMessageBox", 0,  c$, h$,  @hwnd%, @memhdc%

Patrick M
Posts: 31
Joined: Mon 02 Apr 2018, 21:51

Re: Text aligne

Post by Patrick M » Sat 05 May 2018, 16:42


I'm not claiming to be an expert in this area, but, I see you seem to be using system messagebox functions to display your message. Those message boxes will probably end up looking quite different depending on what OS or system you're running on. Window's 'messagebox' API function would probably display the text a bit differently depending on whether you're using Windows XP or Windows 10 for example.
With the SDL_ShowSimpleMessageBox function, the messages could end up looking different depending on what version of SDL you have, what OS you're running that version of SDL on, etc. For example, on my linux system with BBCSDL, the text in message windows created by SDL_ShowSimpleMessageBox are left justified. Even though they're both using SDL, the message appears differently than how it would on android.

With system messagebox functions, you don't really have any fine control over what they do. They only accept a couple of parameters - a title string, and a message string, and that's basically it. They'll just display your strings however they see fit. So my thoughts are that if you want a high degree of control over how your message looks, it'd be best to draw the message yourself using BBC BASIC's native drawing primitives and text printing features.


Posts: 30
Joined: Mon 02 Apr 2018, 15:48

Re: Text aligne

Post by roy » Sun 06 May 2018, 16:03

Thanks Patrick

It look like Android don't like chr$(10) which in Windows sends the cursor to the beginning of the line.

Regards Roy

Post Reply