SOUI官方论坛

 找回密码
 立即注册
查看: 674|回复: 1

主窗口中的hbox改变大小后,主窗口如何自动调整大小

[复制链接]
  • TA的每日心情
    奋斗
    2021-6-22 19:08
  • 签到天数: 1 天

    [LV.1]初来乍到

    1

    主题

    5

    帖子

    63

    积分

    24:00金丹期

    Rank: 2

    积分
    63
    发表于 2020-10-14 19:15:06 | 显示全部楼层 |阅读模式
    ======================== 布局xml

    <SOUI name="window" title="布局" width="-2" height="48" wndType="appMain" toolWindow="0" translucent="0" round="10">

            <root cache="1">
             
        <caption name="caption" pos="0,0,200,-0" show="1" skin="QuickbarWndSK_bg" visible="1" >
          <!-- 1  "Translator" -->
          <imgbtn pos="8,10"  size="32,32" skin="STWndSK_Btn" name="btn_Translator">
            <img skin="STWndSK_Stop" pos="|0,|0" offset="-0.5,-0.5"></img>
          </imgbtn>

          <!-- 2 CreateNormalNote -->
          <hr pos="[10, |0" offset="0, -0.5" size="0, 26" lineSize="1" lineColor="#FFFFFF" lineStyle="solid" mode="vertical"/>

          <imgbtn pos="[8,10"  size="32,32" skin="STWndSK_Btn" name="btn_Translator">
            <img skin="STWndSK_Stop" pos="|0,|0" offset="-0.5,-0.5"></img>
          </imgbtn>

          <!-- 3 CreateTodoList -->
          <imgbtn pos="[8,10"  size="32,32" skin="STWndSK_Btn" name="btn_Translator">
            <img skin="STWndSK_Stop" pos="|0,|0" offset="-0.5,-0.5"></img>
          </imgbtn>

        </caption>
                   
                    <window layout="hbox" size="-1,-1" colorBkgnd="#cccccc" gravity="center" name="LKLK">
                            <!--线性布局的自适应子窗口大小-->
                            <text visible="0" display="0">vbox + gravity + wrapContent</text>
                            <window size="100,30" colorBkgnd="#ff0000" name="xxx"/>
                            <window size="200,30" extend="10,5,10,5" colorBkgnd="#ff0000"/>
                            <window size="120,30" layout_gravity="right" colorBkgnd="#ff0000"/>
                    </window>
            </root>

    ============ 控制代码
            SWindow *tpSW = (SWindow*)FindChildByName(L"LKLK");
            //tpSW->GetChildrenCount();
            SetWndAttribute(L"xxx", L"display", L"0");
            SetWndAttribute(L"xxx", L"visible", L"0");


    ===== SetWndAttribute 窗口类成员函数
            void SetWndAttribute(LPCWSTR wndName, LPCWSTR attribName, LPCWSTR attribValue)
            {
                    SWindow *tpSW = FindChildByName(wndName);

                    if (tpSW)
                    {
                            tpSW->SetAttribute(attribName, attribValue);
                    }
            }

    如上所示:
    1、主窗口是的宽度设置的自动调整
    2、通过代码隐藏了hbox中的子窗口,此时hbox自动调整了大小。
    3、问题来了,主窗口的大小为啥没有自动调整,要想实现自动大小调整,需要怎么干。

    有请大神指导指导~~


  • TA的每日心情
    奋斗
    2022-7-4 09:45
  • 签到天数: 28 天

    [LV.4]偶尔看看III

    59

    主题

    590

    帖子

    5515

    积分

    版主

    Rank: 7Rank: 7Rank: 7

    积分
    5515

    突出贡献优秀版主

    发表于 2020-10-15 11:02:44 | 显示全部楼层
    3.0支持宿主窗口自适应大小。2.x不支持。
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|小黑屋|SOUI官方论坛

    GMT+8, 2024-5-18 13:50

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表