Text Display in GLBasic

Previous topic - Next topic

Pebah

I'm trying to evaluate GLBasic to see if it can do what I want...

In the Help I'm not finding much reference to text display beyond basic strings. Is there the concept of a text field object that displays text?

How would I display a paragraph of text that wraps within a defined border?

If text is read from an external document, is it just plain text? Can GLBasic read and display an HTML file or such?

I'll ultimately want to do all this for iPhone which has all of this. It might seem that I would have to do some kind of hybrid between GLBasic and the iPhone SDK.

Kitty Hello

If you want iPhone controls, which are not cross platform, you have to use a 3rd party library. I think Trucidare once started on a CocoaTouch wrapper.

The GLBasic way would be to use DDgui, which is a cross platform GUI framework, but it does not look native to any OS. (See Samples/_Projects_/DDgui )

MrTAToad

PRINT to send text to the screen
DEBUG to send to the output window
STDERR/STDOUT to send text to the console window.

To wrap text in a defined border, you have to write it yourself, there is the BoxPrint example though in the Samples directory.  Moru's proportional font system does provide a similar thing as well.

Text read from an external document should be standard text - if its something like HTML, it will be up to you to deal with the data.

Moebius

GLBasic does have any 'inbuilt' UI elements like the iPhone SDK does.  There are a number of GUI libraries available what should be able to display wrapped text.  DDGUI is fairly popular from what I know and comes with GLBasic, and should have elements like text-fields, but I haven't used it yet.
To display wrapped text yourself, you would need to work out how many characters fit on a line (use GETFONTSIZE to work out the size of each character, and then use that to work out how many fit on a line), and then get your code to segment the string at whole words so that it fits.

If you are reading from an external document, you can read it into a string or read values, so you can easily get text out of a document into a string.
On displaying files, again there is no real inbuilt stuff for this.  You should be able to find libraries that accomplish, or through inline code you can access UI features and other things available in iOS SDK when you compile for iPhone.  That is, if you understand how to do this stuff in Objective-C.  In GLBasic, you can theoretically use all of the iPhone stuff as far as I know (like the inbuilt UI stuff, and an internal Safari browser to display HTML files), but you will have to write code for this as you would if coding it in XCode.  However, often other people would have already written this code to integrate it into GLBasic, and you won't have to do everything yourself.

EDIT:  some of this stuff has already been mentioned - there were two posts before I got back to my PC and hit the 'Post' button.
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary