NIM_Duilib_Framework icon indicating copy to clipboard operation
NIM_Duilib_Framework copied to clipboard

OptionBox 如果receiver 是全局的一个控件,在设置除第一项之外的其它项selected属性后,无效

Open shuilan0066 opened this issue 4 years ago • 1 comments

        <!-- 账号登录、动态密码登录 选项卡 -->
        <HBox margin="0,42,0,0" halign="center" height="auto" name="optionHBox" visible="true">
            <OptionBox height="auto" cursortype="hand" group="login_opt" name="commonLogin" selected="true">
                <Event type="select" receiver="account_tab" applyattribute="selectedid=&quot;0&quot;" />
                <Event type="unselect" receiver="account_tab" applyattribute="selectedid=&quot;1&quot;" />
            </OptionBox>

             //当设置它为  selected="true"  无效
            <OptionBox height="auto" cursortype="hand" group="login_opt" name="verifyLogin"  >  
                <Event type="select" receiver="twoDimension_tab" applyattribute="selectedid=&quot;1&quot;" />
                <Event type="unselect" receiver="twoDimension_tab" applyattribute="selectedid=&quot;0&quot;" />
            </OptionBox>

             //当设置它为  selected="true"  无效
            <OptionBox height="auto" cursortype="hand" group="login_opt" name="towDimensionLogin">
                <Event type="select" receiver="dynamic_tab" applyattribute="selectedid=&quot;1&quot;" />
                <Event type="unselect" receiver="dynamic_tab" applyattribute="selectedid=&quot;0&quot;" />
            </OptionBox>
        </HBox>


        <TabBox mouse="false" margin="0,70,0,0" mousechild="false" name="account_tab">
            <HBox>
                <Box>
                    <!-- 选中状态 -->
                </Box>
                <Control />
                <Control />
            </HBox>
            <HBox>
                <!-- 未选中状态 -->
            </HBox>
        </TabBox>

代码中: bool Control::OnApplyAttributeList(const std::wstring& strReceiver, const std::wstring& strList, EventArgs* eventArgs) { Control* pReceiverControl; if (strReceiver.substr(0, 2) == L".\" || strReceiver.substr(0, 2) == L"./") { //当前 pReceiverControl = ((Box*)this)->FindSubControl(strReceiver.substr(2)); } else { pReceiverControl = GetWindow()->FindControl(strReceiver); }

if (pReceiverControl) {
	pReceiverControl->ApplyAttributeList(strList);
}
else {
	ASSERT(FALSE);
}

return true;

}

pReceiverControl 为空

shuilan0066 avatar Dec 14 '20 08:12 shuilan0066

确实存在这个问题 selected="true"设置后程序运行不起来

NtDefault avatar Apr 17 '23 00:04 NtDefault