Resizing contents in TabNavigator in flex3 - apache-flex

Hi I am working on tabNavigator in flex 3.
I have tileList within it. Contents in the tab comes dynamically so I cannot provide explicitly fixed height and width.
I need to resize the tabs depending on the contents within it.
To resize the tabs I have enabled 'resizeToContent' property of tabNavigator.For some reason it is not resizing as expected.
Could anybody please suggest me the way out of it.
Thanks
Hey thanks Gregor for you reply,
'resizeToContent' works fine for other child items in tabNavigator but fails when I use tileList as child in tabNavigator that time tileList resizes to its default size(4 rows are only visible). So i was wondering if there any way so that I can force tileList to display all its items without putting scrollbars after its default size.
just by invalidating size on creationComplete ,will that resize all tabs for me. I am having n-number of tabs in tabNavigator as user can add tabs and content within it.
Could you please explain me, how can I achieve this.
I am new to flex so just getting confused with its behaviorand struggling with this issue from long time.

resizeToContent only works when the user changes tabs. If you want the tab to resize once the content has been added, you need to listen for the appropriate event (creationComplete probably) and invalidate the size of the TabNavigator. That will give it an opportunity to resize itself.

Related

Getting QScrollArea to resize its child widget immediately

I have a QScrollArea (we'll call it myContainer) that contains and scrolls a child view (we'll call it myChildWidget). All works almost fine - when I change the height of myChildWidget dynamically in response to something, if the height exceeds that of myContainer (the QScrollArea), a vertical scroll bar pops into view, effectively narrowing myChildWidget since I've set it to resize its child using:
myContainer->setWidgetResizable(true);
The problem is that myChildWidget is not actually resized until later, rather than right when I set its new height or try resizing myContainer, so I can't do certain things depending on its new width without subclassing and putting in a whole bunch of extra code. Surely there's something I can call to get the QScrollArea to auto-resize its child right away, right? I can use:
QCoreApplication::processEvents();
but the problem with that is that it causes the widgets to flash and redraw when I'm not done setting things up. I've tried update(), updateGeometry(), and adjustSize(), both on the container and its child, and none work. Anything I'm missing? Thanks for any help.

Resize QDialog at a runtime

I have a QDialog subclass containing some options of my application. Some of the options are core, the other are advanced, so I decided to put them into separeted checkable QGroupBox.
I want my dialog to shrink verticaly when the user checked off advanced options box, but I can't find the way to do it properly - the dialog size stays exactle the same
I set dialog's size policy to Expanding, tried to call adjustSize() and tried to call resize() method - nothing helps. I can't resize programmaticaly dialog to be smaller then it's current size (it only can become larger). At the same time, it is possible to resize it manualy.
Can anybody help me?
If you don't need manual resize, you can add
layout()->setSizeConstraint(QLayout::SetFixedSize);
to the dialog constructor, then the layout takes over the responsibility to automatically resize when widgets are shown or hidden.

Flex ItemRenderer - how to tell when it's being reused?

I'm using a spark ItemRenderer in a list with useVirtualLayout="true"
The itemRenderer has an image loaded in it.
When the list scrolls, and a new Item is brought into view - the image flickers, briefly showing the previous image in the itemrenderer.
When the itemrenderer is re-used, how can I prevent the flicker?
Is there an event when an itemrenderer is discarded? then I could hide the image or load a blank image.
Try this
A simple way to avoid Flickering images is to give a height according to the total images to show
example
if the List have vertical layout
myList.height = myList.dataProvider.length;
if the List have horizontal layout
myList.width = myList.dataProvider.length;
It depends on how you use the image. I tend to load the image and save its BitmapData ONCE!. Then you can directly use it without any flickering. You just have to inject some sort of ImageRespository into the renderer.
This can easily be done by listing to the rendererAdd event of the DataGroup and stuff the repo into the renderer.

How do I add a scroller to a Menu in Flex 4

In flex 4 I'm using a PopUpButton with a Menu populated with records from the database.
For one of our clients, the data provider of the Menu has more than 50 elements.
When they click on the Menu it expands beyond the height of the screen without showing a scroller or responding to the mouse-wheel. So in effect there is no way to access the lower items on the menu.
So I need to somehow restrict the height of the menu and add a scroller.
The rowCount and maxHeight commands are having no effect.
var companyContextMenu:Menu=new Menu();
companyContextMenu.maxHeight=400;
companyContextMenu.rowCount=20;
The same code was working fine before migrating to Flex 4.
Any help is much appreciated.
In Flex there is a big different regarding scrollbars between version 3 and 4.
First, please don't mix the halos and the sparks.
Then put a scroller-Tag around the menu, that should become a scroller.
Just the container Group, DataGroup, VGroup, HGroup and TitleGroup implement IViewport and can handle the scoller-tag ouround them.
So, put your menu in one of the container above. Is this not handle for you, please post your code.
BR
Frank

Always resize the viewStack

I'm facing one weird problem : I'm using a viewStack which have is property resizeToContent set to true. When I'm selecting a child higher than the viewStack, it's correctly resized, but when I'm selecting another child which is smaller, the viewStack isn't resized !!!
What I want is that my viewStack get the height of the selectedChild each time.
though, the Adobe doc say :
If true, the ViewStack container automatically resizes to the size of its current child.
Have any idea ???
thanks a lot
So...,
as I haven't found any solution, I take a work around : I'm setting a default value for the height of my viewStack each time I'm changing the view seleted....
It's not very clean, but it's work
but if someone found a better soluce, I'll be happy :)

Resources