This is a migrated thread and some comments may be shown as answers.

TextBox problem

3 Answers 82 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
zagy
Top achievements
Rank 1
zagy asked on 16 Dec 2007, 07:51 AM
Hi,

I'm having a lot of problems trying to programatically a TextBox (or RadTextBox or RadTextBoxElement) control to a Button group inside a ribbon chunk).

Here's what I have:
My application is a content editor (a bit like Flash but not nearly so advanced). So when I click on an Image:
1. I want the "Image" context group to appear
2. I want the the correct properties to appear
3. When I change the properties in the ribbon - the image has to change

Because there are several different items and all of them have the same basic functionality I have created:

// class for handling object operations
public

class BaseRibbonObjectHandler : RadRibbonBarCommandTab

// create the chunk
m_chkPositionAndSize =

new RadRibbonBarChunk();
m_chkPositionAndSize.Orientation = System.Windows.Forms.Orientation.Vertical;
m_chkPositionAndSize.Text =
"Position and Size";

// create the ribbon bar group
RadRibbonBarButtonGroup radRibbonBarButtonGroup1 = new RadRibbonBarButtonGroup();
radRibbonBarButtonGroup1.Orientation = System.Windows.Forms.
Orientation.Horizontal;
radRibbonBarButtonGroup1.MinSize =
new System.Drawing.Size(22, 22);
radRibbonBarButtonGroup1.ShowBorder =
true;

// create the labels
RadLabelElement
radLabelElement1 = new RadLabelElement();
RadLabelElement radLabelElement2 = new RadLabelElement();
radLabelElement1.Text = "Width ";
radLabelElement2.Text = "Height ";

// create the textboxes

tbSizeWidth =
new RadTextBoxElement();
tbSizeWidth.MinSize =
new Size(100, 0);
tbSizeWidth.AutoSizeMode =
RadAutoSizeMode.WrapAroundChildren;
tbSizeHeight = new RadTextBoxElement();
tbSizeHeight.MinSize =
new Size(100, 0);
tbSizeHeight.AutoSizeMode =
RadAutoSizeMode.WrapAroundChildren;

// add the controls to the button group
radRibbonBarButtonGroup1.Items.AddRange(
new RadItem[] { radLabelElement1, tbSizeWidth, radLabelElement2, tbSizeHeight });

// add the group to the chunk
m_chkPositionAndSize.Items.Add(radRibbonBarButtonGroup1);

// add the chunks to the control
this.Items.Add(m_chkPositionAndSize);

The idea is that in this class I create the tab page, the basic chunks and the basic items:


If I add the TextBoxes (it doesn't matter which kind of TextBox - RadTextBox, RadTextBoxElement or WinForms TextBox) the application hangs up (If I wait about a minute I get a stack overflow exception).
This behavior happens on 3 machines...

A few more facts:
- I have another chunk (I didn't copy the code here) with a button and a combobox and it works ok
- If I add the radTextBoxElement directly to the chunk (and not to a button group) - it works

Am I doing something wrong? Or is this a bug?

3 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 17 Dec 2007, 09:27 AM
Hi zagy,

Thank you for writing. This is a known issue and we are working on a solution at the moment.
I cannot give you a precise timeframe at the moment, but it will most probably be available in one of our future releases.

For now you can workaround this problem by setting both MinSize and MaxSize as shown below:
RadRibbonBarButtonGroup buttonGroup = new RadRibbonBarButtonGroup(); 
buttonGroup.Items.Add(new RadButtonElement("btn")); 
RadTextBoxElement textBox = new RadTextBoxElement(); 
textBox.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren; 
             
textBox.MinSize = new Size(40, 16); 
textBox.MaxSize = new Size(60, 20); 
buttonGroup.Items.Add(textBox); 
             
this.radRibbonBarChunk1.Items.Add(buttonGroup); 

This should allow you to add text boxes in a button group.

If you have any further questions, please do not hesitate to contact us.

All the best,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
zagy
Top achievements
Rank 1
answered on 20 Dec 2007, 10:55 AM
Great... that solved the problem. Thank you.

When can we expect Q3? And if I buy the controls now, will I still get the Q3 update?
0
Vassil Petev
Telerik team
answered on 20 Dec 2007, 11:46 AM
Hello zagy,

Q3 was released on Tuesday and you can download it from your account!

Let me know what you think of the new version.


Kind regards,
Vassil
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
RibbonBar
Asked by
zagy
Top achievements
Rank 1
Answers by
Jordan
Telerik team
zagy
Top achievements
Rank 1
Vassil Petev
Telerik team
Share this question
or