Move a component
Move a component
Hi. Here's what I would need to do. I have a Text component in the GroupHeaderBand, which gets a number value from the database in the range of 1 to 7. Now, depending on that number, I need to move the other Text component also in that GroupHeaderBand to another position and to change the width of that component.
Is this possible? And also, I would need to put the code somewhere in the designer, i.e. in the GetValue event of the first Text component (or any other event).
Thank You very much for Your help!
Is this possible? And also, I would need to put the code somewhere in the designer, i.e. in the GetValue event of the first Text component (or any other event).
Thank You very much for Your help!
Move a component
You can change position of components in BeforePrintEvent of bands. Type following code in BeforePrintEvent of GroupHeaderBand:
Thank you.
Code: Select all
Text1.Left = DataSource.Index * 20;//You need use selected units
Move a component
Thanks for the reply! It works great!
There's only one problem. I need to move the Text1 component based on the text value of the Text2 component. So, I putted this code in the BeforePrintEvent of the band:
If Text2.Text = "7" Then
Text1.Left = 2
End If
But, it's not working. Is this code ok, or?
Thanks very much for Your help! It was very important for me to do this as soon as possible or my boss would kill me!
There's only one problem. I need to move the Text1 component based on the text value of the Text2 component. So, I putted this code in the BeforePrintEvent of the band:
If Text2.Text = "7" Then
Text1.Left = 2
End If
But, it's not working. Is this code ok, or?
Thanks very much for Your help! It was very important for me to do this as soon as possible or my boss would kill me!
Move a component
Please use following code in GetValueEvent:
Thank you.
Code: Select all
StiText text = sender as StiText;
if (e.Value == "Owner")text.Left -= 1;
Move a component
Sorry, but I don't understand. In GetValue event of which Text component should I put this code? I need to move Text1 component based on the Text2 component's value, i.e. if Text2.Text = "7" Then Text1.Left = 2.
Thanks
Thanks
Move a component
Hi.
I suceeded to do the thing that I needed, but I think I found a bug.
I put this code in GetValueEvent of Text2 component:
Both of the Text components (text1 and text2) are on the GroupHeaderBand.
But, when shown in the preview window, the Text1 component starts moving only in second group. In the first group, the Text1 component is not moved. Example:
First group
GroupHeaderCondition = "100"
Text2 = 7
Text1 => NOT MOVED
Second group
GroupHeaderCondition = "101"
Text2 = 7
Text1 => MOVED
Third group
GroupHeaderCondition = "102"
Text2 = 7
Text1 => MOVED
Fourth group
GroupHeaderCondition = "103"
Text2 = 5
Text1 => NOT MOVED
Fifth group
GroupHeaderCondition = "104"
Text2 = 5
Text1 => MOVED
Sixth group
GroupHeaderCondition = "105"
Text2 = 5
Text1 => MOVED
... and so on. I hope I was able to show what is going on. It seems that the code isn't applied on every GroupHeaderBand.
Do You maybe have a solution?
Thanks!
I suceeded to do the thing that I needed, but I think I found a bug.
I put this code in GetValueEvent of Text2 component:
Code: Select all
If e.value = "7" Then
Text1.Left = 2
ElseIf e.Value = "5" Then
Text1.Left = 1
But, when shown in the preview window, the Text1 component starts moving only in second group. In the first group, the Text1 component is not moved. Example:
First group
GroupHeaderCondition = "100"
Text2 = 7
Text1 => NOT MOVED
Second group
GroupHeaderCondition = "101"
Text2 = 7
Text1 => MOVED
Third group
GroupHeaderCondition = "102"
Text2 = 7
Text1 => MOVED
Fourth group
GroupHeaderCondition = "103"
Text2 = 5
Text1 => NOT MOVED
Fifth group
GroupHeaderCondition = "104"
Text2 = 5
Text1 => MOVED
Sixth group
GroupHeaderCondition = "105"
Text2 = 5
Text1 => MOVED
... and so on. I hope I was able to show what is going on. It seems that the code isn't applied on every GroupHeaderBand.
Do You maybe have a solution?
Thanks!
Move a component
I resolved the problem. I've used the code in the beforePrinting event of the groupheader, but instead of using the value from the Text component, I used the value from the datasource.
Thanks!
Thanks!
Move a component
This is not bug. You need check order of component. In your case Text1 must have order position after Text2.
Thank you.
Thank you.