Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Bug #2 in CXTPTabControl!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Bug #2 in CXTPTabControl!

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Bug #2 in CXTPTabControl!
    Posted: 29 March 2008 at 4:33pm
A small bug, but quite critical if you ask me.
 
m_wndTab.SetCurSel(0); // This causes TCN_SELCHANGE to be sent.
 
From MSDN:
"A tab control does not send a TCN_SELCHANGING or TCN_SELCHANGE notification message when a tab is selected using this function."
 
Makes sense to follow that principle. The same goes for all your other controls too.
 
Can you please fix this in v12?
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 10 May 2008 at 4:56pm
This has not been fixed in v12.0!
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2008 at 7:13pm
Oleg, please change this in the next release! This bug is causing big problems!
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 18 July 2008 at 2:31am

Hi,

Its not bug. CXTPTabControl is not CTabCtrl and not derived from it.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 18 July 2008 at 3:38am
Ok, so please tell me how to change the current selection without getting TCN_SELCHANGE.
 
Like I said, no API cause notification messages to be sent. It's really crazy to violate that principle. Consider this:
 
OnSelChanged(...)
{
    SetCurSel(x); // Let's recur infinitely!
}
 
Notification message = the user did something that you could not predict.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 18 July 2008 at 4:45am
Hi,
 
There will be only one recur call because SetSelectedItem has if (m_pSelected == pItem)  return.
 
You can override SetSelectedItem and don't call base method if you don't need change selection.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 20 July 2008 at 4:44am
Hi, I just recalled my original problem.
 
InsertItem() causes TCN_SELCHANGE to be sent when nItem==0. I can live with the SetCurSel-behavior, but inserting items must not differ depending on its item count! This IS a bug.
 
I'd rather not have comments like this in my source code:
// HACK: In XTP 12.0.1, InsertItem() automatically selects the first item when the requested index is set to 0.
// We add 1 to avoid this. The value will be corrected, but the TCN_SELCHANGED notification will not be sent!
int index = m_wndTab.GetItemCount() + 1;
m_wndTab.InsertItem(index, "Test");
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 27 July 2008 at 1:13pm
At least make CXTPTabManager::SetCurSel virtual, so I can override its behavior...
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2008 at 2:39am
Hi,
 
SetCurSel just call SetSelectedItem method. Override it instead.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.