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

Change size and location at runtime

3 Answers 638 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mercell
Top achievements
Rank 2
Mercell asked on 07 Aug 2007, 07:55 PM
Hi,

How do I change the size and location of a TextBox at runtime?

I tried using the ItemDataBound event to set the size and location of the Processing.TextBox but these properties are ReadOnly.

I have to set the position and size (width) of the the TextBox based on it's value.

Thanks,
Bo

3 Answers, 1 is accepted

Sort by
0
Svetoslav
Telerik team
answered on 08 Aug 2007, 12:36 PM
Hello Bo,

The current version of Telerik Reporting does not allow moving items after the report processing has been started. This is by design.

Since you are the first to request this behavior can you please explain a little more why you need to move/resize the items? We may be able to suggest a resolution for your problems.

 
Regards,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mercell
Top achievements
Rank 2
answered on 09 Aug 2007, 08:47 AM
Hi Svetoslav

I have to print a tree structure with (at designtime) an unknown number of levels with each treenode having an unknown number of childnodes.

What I wanted to do was shift the textboxes to the right when I reached a new level.

Is there another way to accomplish this?

Is it possible to use subreports when the number of levels is unknown at designtime?

Thanks,
Bo
0
Svetoslav
Telerik team
answered on 10 Aug 2007, 08:30 AM
Hi Bo,

Telerik Reporting cannot handle recursive hierarchies by itself in the current version, even though we have plans to add this functionality in the future. This means that you should handle the tree hierarchy by yourself.

To shift the textboxes you can try handling the ItemDataBinding event and modify the size/location of its ItemDefinition.

Have in mind that this ItemDefinition is actually the TextBox that you have created in design time. The same TextBox is used for creating the processing TextBox items that are actually used for rendering. This means that for the next row of the data source you'll have the TextBox created with last changed size/location.

Here is a code snippet that describes the above:

void textBox_ItemDataBinding(object sender, EventArgs e)
{
    // textBox is the processing item - created according to the
    // TextBox definition (template) that you create in design time.
    // The Processing items are created for every row of the data source
    // using the item definitions (templates).

    Telerik.Reporting.Processing.TextBox textBox = (Telerik.Reporting.Processing.TextBox)sender;
   
    // this is the TextBox you've created at design time
    Telerik.Reporting.TextBox textBoxDefinition = (Telerik.Reporting.TextBox)textBox.ItemDefinition;
   
    // Modifying the item definition will make the next processing textbox (for the next row of the data source)
    // to be created with the new values.

    textBoxDefinition.Location = new PointU(Unit.Cm(2), Unit.Cm(1));   
}


 
Greetings,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Mercell
Top achievements
Rank 2
Answers by
Svetoslav
Telerik team
Mercell
Top achievements
Rank 2
Share this question
or