-
Notifications
You must be signed in to change notification settings - Fork 2k
修复TabLayout中存在的一处问题 #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
修复TabLayout中存在的一处问题 #156
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样更好?
@@ -104,12 +104,16 @@ namespace DuiLib | |||
m_iCurSel = iIndex; | |||
for( int it = 0; it < m_items.GetSize(); it++ ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- for (int it = 0; it < m_items.GetSize(); it++)
- {
- GetItemAt(it)->SetVisible(false);
- }
- for (int it = 0; it < m_items.GetSize(); it++)
- {
- if (it == iIndex) {
- GetItemAt(it)->SetVisible(true);
- GetItemAt(it)->SetFocus();
- break;
- }
- }
+ for (int it = 0; it < m_items.GetSize(); it++)
+ GetItemAt(it)->SetVisible(false);
+ GetItemAt(iIndex)->SetVisible(true);
+ GetItemAt(iIndex)->SetFocus();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
第一次和大佬们零距离接触,exciting😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/Iamgublin/DuilibTest 点击左上角的按钮即可看到效果
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看了一下你是把return CLoadLibPathInfoUi::Instance();这个改了,你可以试一下以你这个改法,在void MainWindow::OnClick(TNotifyUI & msg)末尾加上
CEditUI* m_pLibPath = static_cast<CEditUI*>(m_PaintManager.FindControl(_T("libpath_path")));
m_pLibPath->SetText(L"TEST");
运行以后点击上面的按钮,看看编辑框是否有TEST。
这里CreateControl时候必须以单例返回,,同时对duilib进行本次说明的改动,才能保证编辑框每次切换Tab以后,才能在编辑框中正常的显示TEST字符。
我也遇到了这个问题,重用控件时遇到的(多个页显示同一个list, 填充不同的东西)后来解决办法是: tab描述不写重复的,options 切换时控制某个tab显示,之前是1对1,现在是n 对1 就没事了,后来想了想,tab只是一个容器,障眼法,根据option 来显示某tab就可以了。 |
当使用自定义标签初始化TabLayout控件时,如果在同一个Layout控件中使用多个相同的标签:
在Tab切换的时候,如果从第一个Tab切换为第二个Tab时不会发生问题,第二个Tab切换为第一个会发生
控件消失的问题,这里主要是因为TabLayout控件的SelectItem函数中: