Cascades - how to get the actual size of the item?

Hi all

Is it possible to get the actual width/height of the Visual element in cascade? I developed before Qt Quick applications and Qt Quick solution was simple - there's width and height properties which was always updated to the size of the real thing, and you could use them when necessary. In Silverlight, there are ActualHeight() and ActualWidth() for all visible elements. However, in the Cascades, as I see it, there are only minHeight, maxHeight, and preferredHeight and the same width, but there is no property that references element real width or height.

I need, for example, to assign the size appropriate to the ListView items - I want to create horizontal ListView which shows only a single element (that is, the image) at a time, correctly resizes this image to fit, and works for a screen resolution and orientation. Qt Quick, I solved this by linking the width and the height to the width of the container of the element of the list element and (Rectangle) height of ListView and using the good snapMode (i.e. SnapOneItem). This works perfectly for any screen size & resolution. How can I do something like this in stunts without Hardcoding the 'magic numbers' preferredWidth and preferredHeight?

Thanks in advance for your answer.

You can get the width and height by using LayoutUpdateHandler of the element:

https://developer.BlackBerry.com/Cascades/reference/bb__cascades__layoutupdatehandler.html

LayoutUpdateHandler::create(scrollView)
    .onLayoutFrameChanged(this, SLOT(handleLayoutFrameUpdated(QRectF)));

Tags: BlackBerry Developers

Similar Questions

  • How to get the items on a loop at the same time during the execution of the loop for

    Hello

    I am a student. I would like to know how to get the outside loop counter values For in parallel so that the loop runs rather than obtaining the value finally outside the loop for future prospects for the answers.

    Thank you

    Frederick

    You already said yes, and you have said some of the different ways (registrants, locals, reference, queue, etc.). Since the information was provided to your request, the thread can be considered closed? If you want details about how to implement something, you must provide the details on what you are doing.

  • How to get the item to the index by the listview in qml programming

    Hi guys.

    I'm sorry my English not good level.

    At the point of selection Android listview to index easylly, I call ListView.selectionPosition (int index)

    But when you use ListView on cascades qml, I think point get in way to the index.

    Hope you help me.

    For a simple DataModel with a single level of items, you can access the item at a specific position with code of God:
    int position = 0
    var MonElement = myDataModel.data ([position])-requires one [of QVariantList]

  • How to get the items selected from indesign Document?

    Hi all

    I'm trying to get the objects selected by the user in the indesign document, to which the following code, I wrote, but his does not collect do not.

    LayoutTarget InterfacePtr < ILayoutTarget > (myContext, UseDefaultIID());

    if (layoutTarget == nil)

    {

    () CAlert::ErrorAlert

    "layouttarget sucks" );

    breaking ;

    }

    UIDList itemList = layoutTarget-> GetUIDList (kStripStandoffs);

    where mycontext is IActiveContext and after getting the itemlist (all managers of related texts).

    How to perceive the limits of the textframe? (TopLeft, TopRight, BottomLeft, BottomRight).

    Thanks and greetings

    Sanjeev.k

    You must initialize the ILayoutTarget with a CSB. As

    InterfacePtr iLayoutCSB (iSelectionManager-> QueryConcreteSelectionBoss (kNewLayoutSelectionBoss));

    InterfacePtr layoutTarget (iLayoutCSB, UseDefaultIID());

    HTH.

    Jasmine

  • E4X: How to get the items that contain a string pattern in the name of the node?

    Is there a way to retrieve the children of an XMLList where the name of the node of a child contains a template string?

    For example:

    account <>

    < XblahX / >

    < cow / >

    < YblahY / >

    < / recording >

    How to get items in folder which has a node name that contains the string "blah"?

    var rec: XML =

    ;

    var r: RegExp = / blah /;
    var elems:XMLList = rec.children (). (localName () *.search (r) >-1);
    trace (elems. ToXmlString())

  • How to get the item and block error

    Hello

    How can I get the name of the fault block and Item, in relaxation On Error at the level of the form. My goal is to change the error message based on the error code and the element that triggered the error.

    For example: If the error code is 40508 and the order of the day is: MyBlock1.MyItem3, the message will be "unable to insert record, unique values will be allowed MyItem3 into the MyBlock1".


    Thanks in advance
    Rizly

    FRM-40508 is a mistake that is triggered by a block, not by a point. So, it is right that there is nothing in the SYSTEM. TRIGGER_ITEM. Get an error message 'talking', you will need to use DBMS_ERROR_TEXT and DBMS_ERROR_CODE to check the database error (for example of a single key on your table)

  • Anyone know how to get the items 13 installation after the download?

    Downloading files seems to have worked and I can see them in the folder on C: /, however the software is not activated automatically, and Windows 7 does not recognize the file extension.  No idea on how to work around this problem, without going through the download of a second time?

    There should be an executable (.exe) file that accompanies the download you will be using to process the file zipped.

  • How to get the items to scroll behind a menu

    I have a Web site, I've been working on and in the products , the photos are not scroll back, also the entire menu is messed up when downloading Adobe Muse. I tried to send him the pictures and what not at the back but no luck.

    Create a new layer in the layers panel. Highlight the menu, go to the object menu, select move to the layer and select the new layer you created. This ensures that your content will always be under the menu.

    I hope this helps.

    David

    Creative muse

  • How to get the item currently being processed within the State

    Will there be any environment variable that contains the element, as there are some pages and app?

    I would use it in terms of the element. The condition would be coded in a package and called several times through the elements. The problem now is that I need to pass the name of the element in the parameter of the function.

    Any idea?

    It is not available. We hope to provide this in a future release to allow plans for leave to use a code generic, similar to your goals.

    Scott

  • How to get the actual size of control?

    How to get the real size control when the preferred width/height is not defined but control have size which are automatically evaluated (for example contaier with the disposal of the battery)?

    Try the LayoutUpdateHandler: https://developer.blackberry.com/cascades/reference/bb__cascades__layoutupdatehandler.html

  • How to get the physical size of the screen?

    Hi all

    How to get the physical width and height of the screen (not resolution) in inches or in centimeters?

    Is there a method to do

    Thank you very much

    Display.getWidth () and Display.getHeight () you will get the number of pixels.

    Display.getHorizontalResolution (); and Display.getVerticalResolution () to get the pixels per meter.  Then by dividing appropriately you can find the actual size.

  • How to get the text of a SystemPrompt (Cascades)

    Hello

    I've been struggling with this for a few hours now. I followed the example of "dialogues" on github, so I have successfully created a SystemPrompt (the dialog box that allows the user to enter text and accept / reject). Curiously, in this example there is no use of user text input. Do you know how to get the text in my QML? Here you have an example of code that I use:

    My QML:

    // Default empty project template
    import bb.cascades 1.0
    import bb.system 1.0
    
    // creates one page with a label
    NavigationPane {
        id: navigationPane
        Page {
            attachedObjects: [
                SystemPrompt {
                    id: prompt
                    title: qsTr("Enter a text for the label")
                    modality: SystemUiModality.Application
                    inputField.inputMode: SystemUiInputMode.Default
                    inputField.emptyText: "Label text..."
                    confirmButton.label: qsTr("Ok")
                    confirmButton.enabled: true
                    cancelButton.label: qsTr("Cancel")
                    cancelButton.enabled: true
                    onFinished: {
                        if (result == SystemUiResult.ConfirmButtonSelection) {
                            lab1.text = ????? // Here is where I don't know what to do
                        }
                    }
                }
            ]
    
            Container {
                layout: StackLayout {}
    
                Label {
                            id: lab1              text: "Label text"
                    objectName: "lab1"
                    textStyle.base: SystemDefaults.TextStyles.TitleText
                    horizontalAlignment: HorizontalAlignment.Center
                }
    
                Button {
                    text: "Update label"
                    horizontalAlignment: HorizontalAlignment.Center
                    topMargin: 150.0
                    onClicked: {
                        //_appUi.editLabel();
                        prompt.show();
                    }
                }
            }
        }
    }
    

    Be sure to add this in your .cpp file or all of app:

    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    

    and don't forget to include them in your app .cpp file (probably not all are needed, but just in case I leave here for the moment):

    qmlRegisterType("bb.system", 1, 0, "SystemUiButton");
        qmlRegisterType("bb.system", 1, 0, "SystemUiInputField");
        qmlRegisterType("bb.system", 1, 0, "SystemToast");
        qmlRegisterType("bb.system", 1, 0, "SystemPrompt");
        qmlRegisterType("bb.system", 1, 0, "SystemCredentialsPrompt");
        qmlRegisterType("bb.system", 1, 0, "SystemDialog");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiError", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiResult", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiPosition", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiInputMode", "");
        qmlRegisterUncreatableType("bb.system", 1, 0, "SystemUiModality", "");
        qRegisterMetaType("bb::system::SystemUiResult::Type");
    

    Thank you very much

    If you look very carefully by the docs, you'll trip over https://developer.blackberry.com/cascades/reference/bb__system__systemprompt.html#inputfieldtextentr...

    So, replace your? with inputFieldTextEntry() and you will get the text you need.

  • How to get the size of the loaded swf file?

    final/public class main extends Sprite
    {

    public void main()
    {
    loaderInfo.addEventListener (Event.COMPLETE, _onLoadCompleted);
    }

    private void _onLoadCompleted(event: Event): void
    {
    var tw: int = stage.width;
    var e: int = stage.height;
    TSW var: int = stage.stageWidth;
    tsh var: int = stage.stageHeight;

    }

    }

    Above is my project simple as3 in flex builder 3.

    My screen resolution is 1920 * 1080, when debugging, the SWF is stretched to the full EI client area, but the stage.stageWidth is 500 and the stage.stageHeight is 375, stage.widht and stage.height are 0, who can tell me why and how to get the right size of the SWF, named the area size customer of EI in this situation?

    Thank you very much!

    The HTML wrapper can resize the SWF later, so wait a frame and recheck stageWidth/stageHeight.

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • Chart WPF: How to get the limits of PlotArea and axes

    I can't find explicit methods to get limits of PlotArea and axes.

    Please let me know workarounds if they are available. Actually a post explains how to get the PlotArea limits using RangeCursor. Are there alternative means for shafts?

    The photo below shows what I did in WinForms with the methods GetBounds and HitTest. I would like to draw the ornaments on the chart in WPF.

    I have attached a code example of this look ornaments around the plot area and the scales.

    Note that this relies on implementation details of the current version of WPF controls for the ornaments of the scale, as it was more effective than gradually points to test in the graph using the GetScaleAt method. We have intentionally left much of the underlying primitive types with a minimum documentation, like us they have changed in the past and may change in the future. Although these exact members can be removed in a future release, we do not expect to provide an equivalent function and stabilize the primitive API over time.

  • How to get the Subvi (the virtual path is in .exe) reference in Run Time System

    Hello world

    The problem is how to get the reference of the Sub - VI in run time system, when the Subvi is in .exe after construction.

    More details:

    Top of page vi called the Subvi dynamically, so that the Subvi is always included, and the source object is the application.exe.

    After the above configuration, the Sub - VI will be the application.exe. For example, the path of Subvi est...\application.exe\SubVI.vi

    So, how to get the reference of the Subvi in Run Time System?

    I can't do it when you use 'open reference VI' with le...\application.exe\SubVI.vi path in the run time system.

    In fact, I can create a file to include the Subvi, rather than build the Subvi in application.exe, then I can get the convenintly reference. But this isn't my favourate average.

    Thank you

    chenyin

    That is the problem. Call a Subvi dynamic means users could change, but it is also very attractive.

    The dynamic call should be used in a user control, but some parade can avoid problems.

    It depends on why you use dynamic calls...-online 2 main ways:

    -Dynamic call are used to maintain a scalable framework for the code without acting on the executable file-online a single VI distribution managed by the administrator/developer

    -Dynamic call are used to provide a collection of "external" characteristic that could be enriched by the administrator/developer. For example, you provide your customers a set of selectable custom signal filters in the executable.

    In 2 cases, you are only able to assess the skills of the users to know if there is a risk of damage, if there is a change.

    So to stay only master a parade might be to provide dynamic VI without a schema, but with the problem of maintenance, since no in-place editing and more attention to manage distribution.

    Another way is to hide the actual distribution to user-online call dynamic VI but it without name as *.vi but others (a repellent name as system of OS name ) or simply without extension in order to attract not user... but that's debatable...

    Another more difficult but more secure method is to create a consistency check before your routine (version, user, modified date,...)

Maybe you are looking for

  • Need a replacement to break links more

    I love. As always, this addon is disabled once again.What addons provide the same functionality, i.e. "to highlight multiple links and open them in tabs. Yes, I could do another search of 60 minutes and the analysis, but I already did 3 times before

  • Addon help. Was working, now not.

    Sorry people, I asked the writer but I just want to keep options open. "Article 1.2.337.1 of net use.He used to work.Now he constantly gives just a red circle with a white cross in it. But, if I RMB in it and 'visit ISP use page', it works. Then if h

  • Mail update needed.

    While Snow Leopard is is no longer being updated, is the messaging system that belongs to this supported.   My email provider tells me that the message from Apple system is a pain in the A and causes so much trouble; as they review maintenance do not

  • iTunes wants to update an iPhone update...

    Any ideas on why iTunes wants to update my iPhone 9.2.1 when turned 9.2.1 already? Not a huge problem just annoying... Are tired of stuff like re start etc, but still no luck. < image published personal information >

  • How to make the side bar of the finder 'Today' and 'This week' options given (they disappeared when I loaded El Capitan)?

    These options from the sidebar formularies very conveniently in any program that has been done to this day or week and now in el capitan, I can't find any way to get them there! Help...? THX