aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
-rwxr-xr-xTests/Interfaces/testTextBox.crow22
-rw-r--r--src/GraphicObjects/Label.cs11
2 files changed, 27 insertions, 6 deletions
diff --git a/Tests/Interfaces/testTextBox.crow b/Tests/Interfaces/testTextBox.crow
index 9e628099..9623284f 100755
--- a/Tests/Interfaces/testTextBox.crow
+++ b/Tests/Interfaces/testTextBox.crow
@@ -1,5 +1,25 @@
<?xml version="1.0"?>
-<VerticalStack Background="Red" Width="-1" Height="-1">
+<VerticalStack Background="SteelBlue" Fit="true">
+ <HorizontalStack Fit="true">
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="TopLeft"/>
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="TopCenter"/>
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="TopRight"/>
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="LeftCenter"/>
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="Center"/>
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="RightCenter"/>
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="BottomLeft"/>
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="BottomCenter"/>
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="BottomRight"/>
+ </HorizontalStack>
+ <HorizontalStack Fit="true">
+ <TextBox Background="DarkGray" Height="30" Width="70" TextAlignment="TopStretch" Text="TopStretch"/>
+ <TextBox Background="DarkGray" Height="30" Width="60" TextAlignment="HorizontalStretch" Text="HorizontalStretch" />
+ <TextBox Background="DarkGray" Height="30" Width="60" TextAlignment="BottomStretch" Text="BottomStretch"/>
+ <TextBox Background="DarkGray" Height="10" Width="70" TextAlignment="LeftStretch" Text="LeftStretch"/>
+ <TextBox Background="DarkGray" Height="10" Width="70" TextAlignment="VerticalStretch" Text="VerticalStretch"/>
+ <TextBox Background="DarkGray" Height="10" Width="70" TextAlignment="RightStretch" Text="RightStretch"/>
+ <TextBox Background="DarkGray" Height="30" Width="50" TextAlignment="Fit" Text="Fit"/>
+ </HorizontalStack>
<TextBox Name="tb" Multiline="true" Font="droid,16" Margin="5" Text="A\nBB\nCCC\nDDDD"/>
<TextBox Multiline="true" Font="droid,16" Name="tb5" Margin="5" Text="{../tb.SelectedText}"/>
<!-- <TextBox Font="droid,10" Name="tb1" Margin="5" Text="this is a test of a text box"/>
diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs
index 68cd50b6..1af9e04b 100644
--- a/src/GraphicObjects/Label.cs
+++ b/src/GraphicObjects/Label.cs
@@ -379,8 +379,8 @@ namespace Crow
case Alignment.RightStretch://ok
heightRatio = widthRatio = (float)cb.Height / rText.Height;
rText.Height = cb.Height;
- rText.Width = (int)(widthRatio * cb.Width);
- rText.X = cb.X;
+ rText.Width = (int)(widthRatio * rText.Width);
+ rText.X = cb.Right - rText.Width;
rText.Y = cb.Y;
break;
case Alignment.BottomCenter://ok
@@ -429,7 +429,9 @@ namespace Crow
break;
}
}
- OpenTKGameWindow.currentWindow.CursorVisible = true;
+
+ gr.FontMatrix = new Matrix(widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0);
+ fe = gr.FontExtents;
#region draw text cursor
if (mouseLocalPos >= 0)
@@ -487,8 +489,7 @@ namespace Crow
gr.LineTo(new PointD(textCursorPos + rText.X, rText.Y + (CurrentLine + 1) * fe.Height));
gr.Stroke();
}
- gr.FontMatrix = new Matrix(widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0);
- OpenTKGameWindow.currentWindow.CursorVisible = true;
+
for (int i = 0; i < lines.Count; i++) {
string l = lines [i].Replace ("\t", new String (' ', Interface.TabSize));
int lineLength = (int)gr.TextExtents (l).XAdvance;