We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting of tab width on the TabControlExt control.

Thread ID:





946 Sep 5,2002 08:52 AM UTC Sep 6,2002 12:51 PM UTC WinForms 4
Tags: Tools
Stefan Lundberg
Asked On September 5, 2002 08:52 AM UTC

Hi, How can I programmatically modify the tab rect width on the TabControlExt bar. My specific issue is that I want to show/place a ComboBox on the tab when clicking on the selected tab so the user can select his/hers text. In order to have this nicer I need to make the selected tab wider and then put the combo there. I know I can get the current tab rect with GetTabRect but how do I modify it. TIA & BR Stefan (I also has some remarks with the behaviour of MS's combobox but that's their issues. http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&oe=UTF-8&group=microsoft.public.dotnet.framework.windowsforms.controls&selm=10987e1f.0209041002.2c73e5e2%40posting.google.com)

Administrator [Syncfusion]
Replied On September 5, 2002 04:19 PM UTC

Stefan, If the tabs were all the same size then you could use the ItemSize property, but I am sure this is not the case here. An easy workaround is to increase the length of the tab's Text by providing some dummy chars. This should be alright because you will be placing a combobox over it, anyway. I am not sure about the combo issues you mention in the other incident. We however provide a ComboBoxExt class (in our latest version) that might solve your problems. It also provides an easy way to listen to the list-closing event. It is like and unlike the .Net combo in many ways, make sure to read the class ref thoroughly before deciding if this will suite you. There is a sample under Tools\Samples\QuickStart\ComboBoxExtDemo dir. -Praveen Ramesh

Stefan Lundberg
Replied On September 6, 2002 08:06 AM UTC

Hi Praveen and thanks for the quick response. I still have two issues with this. 1, TabControlExt, I can still not fix the change of tab width. I also tested this before you suggested it but it seems as the text update isn't done when I retrieve the tab's width. Here's my code: protected override void OnMouseDown(MouseEventArgs e) { Rectangle rect = this.GetTabRect(SelectedIndex); if ( rect.Contains(e.X, e.Y) ) { SelectedTab.Text = "01234567890123456789"; PerformLayout(); // doesn't help... PlaceComboOnTab(); ShowHideCombo(true); [snip] private void PlaceComboOnTab() { Rectangle rect = this.GetTabRect(SelectedIndex); Point tabCtrlLoc = this.Location; rect.Offset(tabCtrlLoc); m_comboBox.Location = new Point(rect.Left+1, rect.Top+1); m_comboBox.Size = new Size(rect.Width, rect.Height); } Setting text and retrieving the tab's width is done in sequence and I don't get the new width. How can I accomplish this. PerformLayout doesn't help. 2, ComboBoxExt, I've started to use this and it performs a lot better but how do I detect the dropdown 'rollup' event. I want do differentiate between selection from a visible dropdown and just stepping with keyboard when the dropdown is hidden. BR & TIA Stefan

Stefan Lundberg
Replied On September 6, 2002 11:12 AM UTC

Hi, again. Sorry for the big previous post. Regarding issue #1 in the that, I've got it to work with 'invalidate' and 'update'. Number 2 remains though. You write that "provides an easy way to listen to the list-closing event" which I can't figure out. Have a nice weekend! Stefan

Administrator [Syncfusion]
Replied On September 6, 2002 12:51 PM UTC

Stefan, I am glad you got the tab control issue working. We use a slightly different layout mechanism than what .Net provides for bettern performance, due to which your calling the PerformLayout method didn't work. You should instead call the Layout method in the TabControlExt to force layout (this method is protected in the current version, we will make this public in our next release). Regarding the popup close event, there is a PopupContainer property in the ComboBoxExt whose CloseUp event you should subscribe to. Regards, Praveen Ramesh


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon