alternetsoft / AlternetUI

MIT License
22 stars 2 forks source link

Expanding a Control in a vertical stack panel? #87

Closed Shadowblitz16 closed 6 months ago

Shadowblitz16 commented 6 months ago

I didn't know where to make this issue. A discussions tab would probably be good

Anyways Dock=Fill is not working in vertical stack panel

<Window xmlns="http://schemas.alternetsoft.com/ui/2021"
        xmlns:x="http://schemas.alternetsoft.com/ui/2021/uixml"
        x:Class="SMBX_R.MainWindow"
        Title="SMBX_R">
        <Window.Menu>
                <MainMenu>
                        <MenuItem Text="_File">
                                <MenuItem Text="_Open" Name="OpenMenuItem" Click="OpenMenuItemClick" Shortcut="Ctrl+O"/>
                                <MenuItem Text="_Save" Name="SaveMenuItem" Click="SaveMenuItemClick" Shortcut="Ctrl+S"/>
                                <MenuItem Text="_Save As..." Name="SaveAsMenuItem" Click="SaveAsMenuItemClick"/>
                                <MenuItem Text="-"/>
                                <MenuItem Text="E_xit" Name="exitMenuItem" Click="ExitMenuItemClick" />
                        </MenuItem>
                        <MenuItem Text="_Edit">
                                <MenuItem Text="Undo" Name="UndoMenuItem" Click="UndoMenuItemClick" Shortcut="Ctrl+Z"/>
                                <MenuItem Text="Redo" Name="RedoMenuItem" Click="RedoMenuItemClick" Shortcut="Ctrl+Y"/>
                                <MenuItem Text="-"/>
                                <MenuItem Text="Cut" Name="CutMenuItem" Click="CutMenuItemClick" Shortcut="Ctrl+X"/>
                                <MenuItem Text="Copy" Name="CopyMenuItem" Click="CopyMenuItemClick" Shortcut="Ctrl+C"/>
                                <MenuItem Text="Paste" Name="PasteMenuItem" Click="PasteMenuItemClick" Shortcut="Ctrl+V"/>
                                <MenuItem Text="Delete" Name="DeleteMenuItem" Click="DeleteMenuItemClick" Shortcut="Ctrl+Del"/>
                        </MenuItem>
                </MainMenu>
        </Window.Menu>
        <VerticalStackPanel Dock="Fill">
                <Control UserPaint="true" BackColor="Black" Dock="Fill"/>
                <Grid Name="Blocks">
                        <GroupBox>
                                <Grid Name="Grass">
                                        <Button MinWidth="32" MinHeight="32"/>
                                </Grid>
                        </GroupBox>
                </Grid>
                <Panel>
                        <HorizontalStackPanel>       
                                <Button Name="SelectTool" Text="Select"/>
                                <Button Name="EraseTool" Text="Erase"/>
                                <Button Name="BlockTool" Text="Blocks"/>
                                <Button Name="BgosTool" Text="Bgos"/>
                                <Button Name="NpcsTool" Text="Npcs"/>
                                <Button Name="WarpsTool" Text="Warps"/>
                                <Button Name="LiquidsTool" Text="Liquids"/>
                                <Button Name="SettingsTool" Text="Settings"/>
                        </HorizontalStackPanel>
                </Panel>
        </VerticalStackPanel>
</Window>
generalloki commented 6 months ago

Currently Control.Dock works only in LayoutPanel. I am working on a new layout mechanism (in which Control.Dock will be supported in all containers) and will post here an update when it is ready. For now, If you want to stretch child control of a VerticalStackPanel, assign it's VerticalAlignment = VerticalAlignment.Stretch.

generalloki commented 6 months ago

I see you are using Grid control. In order to setup it properly, children of the grid must have ColumnIndex, RowIndex. And Grid itself must be initialized with RowCount and ColumnCount, or with Row and Column collections. See our samples with Grid control.

Shadowblitz16 commented 6 months ago

ok thankyou

Shadowblitz16 commented 6 months ago

image Stretch is already the default.

And it's not working. image

Any ideas?

<Window xmlns="http://schemas.alternetsoft.com/ui/2021"
        xmlns:x="http://schemas.alternetsoft.com/ui/2021/uixml"
        x:Class="SMBX_R.MainWindow"
        Title="SMBX_R">
        <Window.Menu>
                <MainMenu>
                        <MenuItem Text="_File">
                                <MenuItem Text="_Open" Name="OpenMenuItem" Click="OpenMenuItemClick" Shortcut="Ctrl+O"/>
                                <MenuItem Text="_Save" Name="SaveMenuItem" Click="SaveMenuItemClick" Shortcut="Ctrl+S"/>
                                <MenuItem Text="_Save As..." Name="SaveAsMenuItem" Click="SaveAsMenuItemClick"/>
                                <MenuItem Text="-"/>
                                <MenuItem Text="E_xit" Name="exitMenuItem" Click="ExitMenuItemClick" />
                        </MenuItem>
                        <MenuItem Text="_Edit">
                                <MenuItem Text="Undo" Name="UndoMenuItem" Click="UndoMenuItemClick" Shortcut="Ctrl+Z"/>
                                <MenuItem Text="Redo" Name="RedoMenuItem" Click="RedoMenuItemClick" Shortcut="Ctrl+Y"/>
                                <MenuItem Text="-"/>
                                <MenuItem Text="Cut" Name="CutMenuItem" Click="CutMenuItemClick" Shortcut="Ctrl+X"/>
                                <MenuItem Text="Copy" Name="CopyMenuItem" Click="CopyMenuItemClick" Shortcut="Ctrl+C"/>
                                <MenuItem Text="Paste" Name="PasteMenuItem" Click="PasteMenuItemClick" Shortcut="Ctrl+V"/>
                                <MenuItem Text="Delete" Name="DeleteMenuItem" Click="DeleteMenuItemClick" Shortcut="Ctrl+Del"/>
                        </MenuItem>
                </MainMenu>
        </Window.Menu>
        <VerticalStackPanel>
                <Control UserPaint="true" BackColor="Black" VerticalAlignment="Stretch"/>
                <Panel>
                        <HorizontalStackPanel>       
                                <Button Name="SelectTool" Text="Select"/>
                                <Button Name="EraseTool" Text="Erase"/>
                                <Button Name="BlockTool" Text="Blocks"/>
                                <Button Name="BgosTool" Text="Bgos"/>
                                <Button Name="NpcsTool" Text="Npcs"/>
                                <Button Name="WarpsTool" Text="Warps"/>
                                <Button Name="LiquidsTool" Text="Liquids"/>
                                <Button Name="SettingsTool" Text="Settings"/>
                        </HorizontalStackPanel>
                </Panel>
        </VerticalStackPanel>
</Window>
generalloki commented 6 months ago

I beleive in 0.9.505 there is AllowStretch property in StackPanel. Set it True to have Control with VerticalAlignment="Stretch" stretched vertically. But in the new (not yet released) builds we removed this property and added VerticalAlignment.Fill which will do the job. I will post here a note when new build with improved layout mechanism is available.

Shadowblitz16 commented 6 months ago

@generalloki is the kubuntu one you made for me the new release or the old one?

generalloki commented 6 months ago

@Shadowblitz16

You can use this project Install.Scripts\MinMasterTemplate\ as a template for projects which use latest Master version of the Alternet.UI. There is a readme.md with the instructions.

Also I have added there a sample of expanding a control to fill it's container. See logListBox control...

I beleive we could close this issue

Shadowblitz16 commented 6 months ago

@generalloki I copied the bin and obj files from Install.Scripts\MinMasterTemplate\ to my project And I get a error when trying to use VerticalAllignment="Fill"

I also tried AllowStretch="true" on the VerticalStackPanel and nothing changed.

generalloki commented 6 months ago

You don't need to copy Bin and Obj from MinMaster

From readme.md of MinMaster:

In MinMaster sample main form shows Fill aligned ListBox control

Shadowblitz16 commented 6 months ago

ok thankyou

Shadowblitz16 commented 6 months ago

@generalloki is there a way you can build this under nuget as a preview?

It would be much easier for me to update the nuget package rather then building the MinMasterTemplate project. Then you can use non prerelease for stable versions.

Shadowblitz16 commented 6 months ago

@generalloki

=====================

Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.200

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux

----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
MSBuild version 17.9.4+90725d08d for .NET
  Determining projects to restore...
  Restored /home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI/Alternet.UI.csproj (in 5.95 sec).
  Restored /home/shadowblitz16/Documents/Source/cs/AlternetUI/Install.Scripts/MinMasterTemplate/MinMaster.csproj (in 5.95 sec).
/home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI/Drawing/Color/KnownColorTable.cs(565,13): warning SA1515: Single-line comment should be preceded by blank line (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1515.md) [/home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI/Alternet.UI.csproj::TargetFramework=net6.0]
  Alternet.UI -> /home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI/bin/Debug/net6.0/Alternet.UI.dll
/usr/share/dotnet/sdk/8.0.200/Microsoft.Common.CurrentVersion.targets(5254,5): error MSB3030: Could not copy the file "/home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI.Pal/bin/x64/Debug/Alternet.UI.Pal.dll" because it was not found. [/home/shadowblitz16/Documents/Source/cs/AlternetUI/Install.Scripts/MinMasterTemplate/MinMaster.csproj]
/usr/share/dotnet/sdk/8.0.200/Microsoft.Common.CurrentVersion.targets(5254,5): error MSB3030: Could not copy the file "/home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI.Pal/bin/x64/Debug/Alternet.UI.Pal.pdb" because it was not found. [/home/shadowblitz16/Documents/Source/cs/AlternetUI/Install.Scripts/MinMasterTemplate/MinMaster.csproj]

Build FAILED.

/home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI/Drawing/Color/KnownColorTable.cs(565,13): warning SA1515: Single-line comment should be preceded by blank line (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1515.md) [/home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI/Alternet.UI.csproj::TargetFramework=net6.0]
/usr/share/dotnet/sdk/8.0.200/Microsoft.Common.CurrentVersion.targets(5254,5): error MSB3030: Could not copy the file "/home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI.Pal/bin/x64/Debug/Alternet.UI.Pal.dll" because it was not found. [/home/shadowblitz16/Documents/Source/cs/AlternetUI/Install.Scripts/MinMasterTemplate/MinMaster.csproj]
/usr/share/dotnet/sdk/8.0.200/Microsoft.Common.CurrentVersion.targets(5254,5): error MSB3030: Could not copy the file "/home/shadowblitz16/Documents/Source/cs/AlternetUI/Source/Alternet.UI.Pal/bin/x64/Debug/Alternet.UI.Pal.pdb" because it was not found. [/home/shadowblitz16/Documents/Source/cs/AlternetUI/Install.Scripts/MinMasterTemplate/MinMaster.csproj]
    1 Warning(s)
    2 Error(s)

I can't build the MinMasterTemplate

EDIT: image The file extension in the folder is a .so and it's looking for a .dll

Shadowblitz16 commented 6 months ago

I reported it as a separate issue.