Main Site Documentation

Multiline TextBox


#1

Hi,

Has anyone developed a multiline textbox for Glide 1.0.3?

The keyboard has 3 line input, but not a 1:1 with the resulting graphics object.

Ian


#2

A year and a half passed since the original post, any updates on this topic?


#3

Thanks.

However, TextBlock differs from TextBox, both in presentation (no border) and in behaviour (OpenKeyboard event does nothing with a TextBlock).


#4

[quote=“andre.m”]
the good thing as a software developer you can write whatever function you want ;)[/quote]
Yeah I figured out that already.

Is there a formal specification on what controls are there and what do they do and how do they behave?

I suppose Glide.Display.DisplayObject should contain Text field like its elder brother System.Windows.Forms.Control does.


#5

I mean, is there a design document that says “control X is for displaying data and soliciting user input, it has borders such and such, whereas control Y is just for displaying text and has no borders”? These links provide no insight on that.


#6

Alright!

In order to have a multiline TextBox one has to add MultiLine property to it and rewrite Render to accept it:

in Glide\UI\Text\TextBox.cs:



        /// <summary>
        /// Specifies that the control is multiline
        /// </summary>
        public bool Multiline { get; set; }

        public override void Render()
        {
            int x = Parent.X + X;
            int y = Parent.Y + Y;
            ushort alpha = (Enabled) ? Alpha : (ushort)(Alpha / 3);
            Parent.Graphics.Scale9Image(x, y, Width, Height, _TextBox, 5, 5, 5, 5, alpha);
            if (Multiline)
            {
                var tex = Text;
                Parent.Graphics.DrawTextInRect(text, x + leftMargin, y + 3 , Width - (leftMargin * 2), Height, TextAlign, FontColor, Font);
            }
            else
                Parent.Graphics.DrawTextInRect(ShortenText(Text), x + leftMargin, y + ((Height - Font.Height) / 2), Width - (leftMargin * 2), Height, TextAlign, FontColor, Font);
        }

The if clause is added, with the false branch being the default/out-of-the-box (single line) behavior.

I’m assuming that no one really wants a multiline password box xD


#7

I’m having an issue though.
In Glide Designer I’ve set font to Droid Sans Regular, 14pt (Font=“5”), which seems to be the same font the KeyboardText object uses internally (droid_reg14, ordinal 5 in FontManager.FontType enum), however the controls are rendered in strikingly different typefaces. Compare: