How to get descendants of a panel in teststack.white - ui-automation

I need some elements that are the childs of some 3-4 panels, but in those panels I can identify only the 1st parent panel and rest don't have any identifiers, so please help me to find the descendants of the 1st parent panel.
let's say - Parent#1 only can be identified as "workspace" but the immediate child panels are not detectable (Edit#1/ Edit#2 and button under unknown panels are identified), so i want to reach to the edit boxes, please help?

Try this
Use SearchCriteria to find the parent Panel1
Use the GetElement method in TeskStack.White.UIItem:
Panel1.GetElement(SearchCriteria searchCriteria)

Related

How can I wrap contents of a textbox that's next to a picture control?

I have the following defined in Active Reports 8 (a picture control with a border--shape--next to textbox fields):
I have more textbox fields below the two defined here, but this is just to illustrate my issue.
Anyway, how do I get the first textbox to wrap without overlapping the second textbox like below?
When I get rid of the picture and shape on the left, everything wraps as expected.
This is actually a known issue and is caused when controls are placed adjacent to each other and one side of the control has a larger height as compared to the ones on the other. Considering your example, let's say the top textbox is TextBox1 and the bottom one is TextBox2. You can handle the BeforePrint event of the Detail section and resolve this issue. For example take a look at the code below:
public void Detail_BeforePrint()
{
TextBox2.Top = TextBox1.Top + TextBox1.Height;
}
Hope this helps.

how to hide and unhide authoerable tabs depending upon value selected from a drop down in CQ5

i am trying to create a footer component in CQ5, where i have 4 columns & all are autherable.
But we have to make no of columns autherable too i.e based on a value selected form a dropdown we have to open those many tabs for authoring those many columns only.
i have created a dropdown and have a maximum range of 6 columns. i know that i have to configure a listener for this purpose but don't know how . Requirement is like if i select 3 from the drop down then 3 tabs should come to author 3 columns
pls help me , i am middle of something very important.i need the solution very early too as i have to finish the job as soon as possible
I might be late for this by now but in case you still need it:
You need to add a listener node before closing your drop-down element:
<listeners
jcr:primaryType="nt:unstructured"
loadcontent="function(box){ //here you also need to handle the hide/unhide when the panel loads for the first time. Use this.getValue() to retrive the intial value }"
selectionchanged="function(box, value) {
for(var c=1;c<=value;c++){
this.findParentByType('tabpanel').unhideTabStripItem("tab"+c); // You need to handle the opposite with hideTabStripItem("tab"+c);
}
}"/>
Then on both "loadcontent" and "selectionchange" (these are events on your drop-down) grab the current selected value and use it to hide/unhide the tabs. In this case the tabs would be named "tab1", "tab2", etc, make sure you get the names right.
The ExtJS in the events is finding the "tabpanel" container for the whole dialog, and then hiding/unhiding based on name. You could also set to enable/disable using the methods ".enable()" and ".setDisabled(true)". Just make sure you get the reference to the tab first if you want to do this (something like ".getComponent(tabName).enable()").
I didn't test this specific code, I couldn't find my actual example from my code base but this should take you in the right direction.

GWT Drag and Drop within tree and between tree grids

We're using GWT and We're required to create two drag and drop tree grids. Each tree contains parents and children (max two level for now).
Here's what we need to be able to do:
Use cases
Drag a parent from one tree grid to the other.
Drag a parent 1 to parent 2 (1 will become child of 2, and all 1's children will become children of 2) -> please don't ask :D
Drag a child from one parent to another (within the same tree grid)
Drag a child to top level within the same tree grid (child will become a parent)
Drag a child to the other tree grid with two options
1 - Top level - child from tree 1 will become a parent on tree 2.
2 - Parent - Child from tree 1 will become child of a parent on the tree grid 2.
If this doesn't make much sense, we don't have the full context yet, so that's all we know.
Problem
We can drag on the same tree grid. If the row we want to drag the cell to is hidden, we set the scroll to true, so that the grid scrolls when the user is dragging inside it. Something like so:
private void setDraggableOptions(DragAndDropColumn<?, ?> column) {
// retrieve draggableOptions on the column
DraggableOptions draggableOptions = column.getDraggableOptions();
draggableOptions.setScroll(true);
// use template to construct the helper. The content of the div will be set
// after
draggableOptions.setHelper(HelperType.CLONE);
// opacity of the helper
draggableOptions.setOpacity((float) 0.8);
// cursor to use during the drag operation
draggableOptions.setCursor(Cursor.MOVE);
// set the revert option
draggableOptions.setRevert(RevertOption.ON_INVALID_DROP);
// prevents dragging when user click on the category drop-down list
draggableOptions.setCancel("select");
column.setDraggableOptions(draggableOptions);
}
Now the problem is, setting the tree grid to scroll, the user will never be able to drag the object to the second tree as the scroll will try to keep the object always inside the grid.
We're using the gwtquery-plugins
Is there any idea to work around this? Thank you very much in advance.
See my response to your question here

Displaying forms using Tree in Qt

I'm building a Qt plugin with multiple forms. I have a main form which has a tree widget placed on the left of the form.
I want to add items to this tree, such that clicking on these items would load the corresponding form on the same form. But I want the tree widget to be active so that I can select any other form also.
I was able to display a form on the main form using the following code:
Form1 *myform;
myform=new Form1(this);
myform->show();
where Form1 is the class of the form i intend to display. However this, covers up the tree widget also. And I have to do a string comparison of the item in tree being clicked to display the appropriate form.
Can someone please help me with this as I'm very new to Qt programming.
Thanks
ixM has a good suggestion. The first step should definitely be to use layouts in your main window - separating the tree from the rest of the window - where you are going to put your form. I would suggest using a splitter, because then the user can resize the two halves. You can set the splitter as the main widget of your CentralWidget in your main window.
QSplitter splitter = new QSplitter(CentralWidget);
splitter->setOrientation(Qt::Horizontal);
splitter->setHandleWidth(3);
splitter->setChildrenCollapsible(false);
MyTree= new QTreeWidget(splitter);
splitter->addWidget(MyTree);
Then add your tree widget to the splitter, which will be on the left side.
The next step is to add a placeholder widget on the right side of your splitter. We are also going to add a layout inside that widget. This layout is very important we are going to use it later.
QWidget WidgetRightSide = new QWidget(splitter);
QVBoxLayout setupLayout= new QVBoxLayout(WidgetRightSide);
setupLayout->setSpacing(0);
setupLayout->setContentsMargins(0, 0, 0, 0);
Now, at this point, this is where my answer really differs from the previous answer. You could use a QStackedWidget. That is certainly an option. The problem with that is that you have to create and load all your forms at the beginning. That uses way more memory, and will take longer to start up. That's not so bad if you have 2-5 forms, but when we are talking about 20, 30 or more forms that's really ugly.
So what I would suggest instead, is that when the user selects something in the tree, we will remove the old form, and add the newly selected form at that point.
When the selected item in the tree changes this is now what we have to do.
First, remove all the stuff from the previously selection form.
QLayoutItem *_Item;
while ((_Item = setupLayout->takeAt(0)))
delete _Item;
Next, figure out what form to show next, and create it.
QWidget *ActiveSetupForm = NULL;
if ( I need to load form 1)
{
ActiveSetupForm = new YourNewForm( WidgetRightSide);
}
else ...
And lastly, add your new form to our layout.
if(ActiveSetupForm)
{
setupLayout->addWidget(pActiveSetupForm);
}
Just as a side note. Layouts are tricky to do by hand. I would strongly suggest that you look into using the QtDesigner when you are creating your forms. It makes life soooo much easier. If you would like to know more about it check out this link.
I don't exactly understand what you are trying to achieve but the bit of code you are showing suggests that you do not use the layouts provided by Qt.
If your goal is to be able to dynamically load a form depending on the item that was clicked in the tree, you could achieve that by having a layout (let's say QHBoxLayout) where you would insert your tree and a QStackedWidget in which you could "store" each form (by using addWidget()) and choose which one you want to display by calling setCurrentIndex().

ScrolledComposite splits the screen vertically and content is displayed in the right half

I am using the ScrolledComposite for a existing control(with many children) based on the method2 mentioned here :http://www.placelab.org/toolkit/doc/javadoc/org/placelab/util/swt/SwtScrolledComposite.html
The only change is instead of creating a new shell & display I am using the existing control's parent.
I am seeing the scroll bars as expected but the existing control/content is displayed form the centre & not from the start. The first half(vertically split) of the layout is empty & the actual control/content gets displayed in the right-half.
I checked bounds, Origin, size etc. they seem to be fine.
screenshot putup here :http://img818.imageshack.us/i/contentstartsfrommiddle.jpg
Any clues
Thanks in advance
Did you delete the Composite c1? maybe that is in the left side.
You could also provide what is exactly your change to the code.