Management of the events of Cascades

How do we consume the event top if onTouchEnter has been called? I have some of these containers on screen. When I'm in the State down on a container and I move to another, I get the event put on the newly selected container. Is it something I can call in onTouchEnter to ignore the next event?

I was able to make it work in QML.

Here's the QML which forms the basis of all my custom buttons:

PanelButton.qml

import bb.cascades 1.0

Container {
    property variant pageToLoad: ""    property variant state: TouchEvent.Up

    id: panelBtn
    layout: DockLayout {
    }

    //the background image is 9 sliced and expands to the size of the button
    ImageView {
        layoutProperties: DockLayoutProperties {
            horizontalAlignment: HorizontalAlignment.Fill
            verticalAlignment: VerticalAlignment.Fill
        }
        id: "btnBG"
        imageSource: "asset:///ui/panel_up"
        scalingMethod: ScalingMethod.Fill
        minWidth: 60
        minHeight: 60
    }

     //
    onTouch: {
        //
        if (event.isUp () && panelBtn.state == TouchType.Down) {
            panelBtn.state = TouchType.Up;
            btnBG.imageSource = "asset:///ui/panel_up";
            root.navClick (pageToLoad);
        }

        //
        if (event.isDown ()) {
            btnBG.imageSource = "asset:///ui/panel_down";
            panelBtn.state = TouchType.Down;
        }
        else if(event.isCancel ())
        {
            btnBG.imageSource = "asset:///ui/panel_up";
            panelBtn.state = TouchType.Up;
        }
    }

    //
    onTouchExit: {
        btnBG.imageSource = "asset:///ui/panel_up";
        panelBtn.state = TouchType.Up;
    }

    //
    onTouchEnter: {
        btnBG.imageSource = "asset:///ui/panel_up";
        panelBtn.state = TouchType.Up;
    }
}

Tags: BlackBerry Developers

Similar Questions

  • Question of optimization: 1 handler for multiple events or 1 Manager by the event?

    Something I can't decide, simply because I'm not sure what would be most effective.

    Example: I have a few menus, each with a handful of icons click on (say a total of 10 objects that can be clicked on).

    Would it not be better to have 1 stage.addEventListener (MouseEvent.MOUSE_DOWN, clickHandler); with 10 if (e.target.name == "nameX") who is called on each click.

    Or would it be better to have 10 separate objectX.addEventListener (MouseEvent.MOUSE_DOWN, clickHandlerX); for each menu item that can be clicked?

    I suppose my confusion comes from not knowing what a listener does exactly, it uses all the resources I look for an event?

    (added)

    After typing all this, a good comparison would be closer to an event listener is nothing else than a way to call a function and is not otherwise using resources?

    My question is still, but I'm leaning towards several Auditors and managers.

    (add 2)

    Sorry my brain blurs, I'm not good at explaining things.  I think it's a little clearer.

    For 1 menu I 1 this.addEventListener, and in the Manager, he has several if (menu_itemX.name == "nameX").
    It is better to have 1 eventListener in this situation, or would it be better to have several menu_itemX.addEventListener and managers separated for each action?

    (follow-up question)

    I did addEventListener when the menu opens and removeEventListener when the menu closes.  If the event listeners do not use 'no' resources unless their event fires is a bad practice for simple click and mouseover events mouseout/mouseouthandler()?  Should I just leave the event listeners here all the time?

    (sample code)

    If this makes it more clear which of these would work better?

    Version 1:

    this.menu1.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler1);
    this.menu2.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler2);
    this.menu3.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler3);
    this.menu4.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler4);
    this.menu5.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler5);
    
    function clickHandler1(e:Event):void{}
    function clickHandler2(e:Event):void{}
    function clickHandler3(e:Event):void{}
    function clickHandler4(e:Event):void{}
    function clickHandler5(e:Event):void{}
    

    version 2:

    this.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler);
    
    function clickhandler(e:Event):void{
    if(e.target.name == "menu1"){}
    else if(e.target.name == "menu2"){}
    else if(e.target.name == "menu3"){}
    else if(e.target.name == "menu4"){}
    else if(e.target.name == "menu5"){}
    }
    
    

    the leave it alone as long as your menu works as expected while adding them.

    leaving the listener takes memory.  removing it frees this memory.

    but free up memory and adding memory uses system resources, especially when free memory flash gc.  It is unnecessary to repeatedly the gc objects that will be added to memory later.

  • problems in the management of the event

    Hi all,
    
    I have created screen with CustomObject List and back button
    
    I have add back button using setTile
    
    and add ChangeListener to back button
    
    problem is when i click back button it's always call navigationClick method
    in side navigation method I have handled logic if I click customObjectList item
    
    so it forward to wrong page
    
    how to check click event is for back button or customObjectList
    
    public class TransactionDetailScreen extends MainScreen {
    
        private CustomObjectListField customObjListField = null;
    
        private VerticalFieldManager vfm = null;
        private Vector details;
        private ButtonField back;
    
        public TransactionDetailScreen(Vector details){
    
            this.details=details;
    
            vfm = new VerticalFieldManager();
    
            final int displayWidth = Display.getWidth();
            final int displayHeight = Display.getHeight();
            final Bitmap logoBitmap =  Bitmap.getBitmapResource("res/logo_b.png"); 
    
            VerticalFieldManager mainManager = new VerticalFieldManager(
                    VerticalFieldManager.USE_ALL_WIDTH  | VerticalFieldManager.NO_VERTICAL_SCROLL){
                // override pain method to create the background image
                public void paint(Graphics graphics) {
                    // draw the background image
                    graphics.drawBitmap(0, 0, displayWidth, displayHeight, logoBitmap, 0, 0);
                    super.paint(graphics);
                }
            }; 
    
            HorizontalFieldManager buttonManager = new HorizontalFieldManager(Field.FIELD_RIGHT){
                protected void paint(Graphics graphics) {
                    graphics.setBackgroundColor(Color.WHITE);
                    graphics.clear();
                    super.paint(graphics);
                }
            };
    
            back=new ButtonField("Back",ButtonField.CONSUME_CLICK);
            back.setChangeListener(new FieldChangeListener()
            {
                public void fieldChanged(Field field, int context)
                {
                    UiApplication.getUiApplication().popScreen(getScreen());
                }
            }); 
    
            FocusableLabelField lblMesg = new FocusableLabelField("Transaction Details", USE_ALL_WIDTH | FIELD_HCENTER | DrawStyle.HCENTER);
            buttonManager.add(back);
            buttonManager.add(lblMesg);
    
            vfm.add(new SeparatorField());
    
            int detailSize=details.size();
            AffinityDetail[] affDetails=new AffinityDetail[detailSize];
    
            details.copyInto(affDetails);
    
            customObjListField = new CustomObjectListField(affDetails,true);
            customObjListField.setRowHeight(3 * (customObjListField.getFont().getHeight()) + 3);
            customObjListField.set(affDetails);
    
            vfm.add(customObjListField);
            mainManager.add(buttonManager);
            mainManager.add(vfm);
            this.add(mainManager);  
    
        }
    
        public void setElement(){
            add(customObjListField);
        }
    
        protected boolean navigationClick(int status, int time)
        {
            Dialog.alert("navigationClick");
    
            int index = customObjListField.getSelectedIndex();
            AffinityDetail  detail=(AffinityDetail)customObjListField.get(customObjListField, index);
            TransactionInfoScreen info=new TransactionInfoScreen(detail);
            UiApplication.getUiApplication().pushModalScreen(info); 
    
            return true;
        }
    
    }
    

    You override navigationClick() at the level of the screen and return true from here (which means that you have consumed the event) - No wonder screen is routing not this click on the button "Back".  If you insist on going in this direction, take a look at getLeafFieldWithFocus() - compare the result to the rear or customObjectList and react accordingly.

    However, there is no reason to substitute navigationClick() where you do.  Since by default, it is spread on the ground with emphasis, override this method for each specific area (or for custom fields, in their classes, which is the most logical place) or individually define the change of field Auditors.  In fact, you can even together in the same field change listener and checks if the field parameter is equal to back, lblMesg or customObjectList.

  • Components customized QML: management of the events of the child controls

    The tutorial here:

    https://developer.BlackBerry.com/Cascades/documentation/UI/custom_components/custom_components_tutor...

    Shows how to use the alias so that you can read the values of the properties of the child controls.

    It would be good to have a code example that shows how to hang children change events. For example, if your custom control has a control segment, how to make the custom control user be notified when there is a click on segment control event or when the value of this control is changed.

    Signals can be easily created in QML and exposed from a QML file that is customized to be listend to another. The following article explains the basic process:

    https://developer.BlackBerry.com/Cascades/documentation/UI/signals_slots/index.html

    In its simplest form, a signal is created in QML using the following format:

    signal signalName (variableType variable1,...)

    In the QML implementation of this custom control file, you will now have a manager of signal onSignalName created automatically for you.

    I covered this topic in my last webcast and created a sample file that looks like this:

    https://developer.BlackBerry.com/Cascades/documentation/videos/index.html

    Beta 1: Astonishing UIS using the new framework of BlackBerry 10 - part 2

    The sample was created against the Beta 1 of the NDK for BlackBerry 10 but the QML (TaskControl.qml) file should work fine in the beta 2 release. If you are having trouble please post it here and I will consider.

    Kind regards

  • Firefox is constantly stopping, aging, and does not when on the home page yahoo uk, Manager of the tasks is that means to stop it, no event will block

    Latest version of Firefox, keep up to date. 8.1 Windows running on del optiplex 620, 2 GB of ram, 80 GB disk partitioned with Win10 on the other. Panda free av and malwarebytes free running. Never had any problem with Win 8.1 up to now, I have returned to it because of many problems with Win 10. Did you check Event Viewer, nothing, checked for crash report, nothing. No malware not reported. Whenever the only solution is to stop Fox with the Manager of the tasks and then restart when Fox goes back to where she was.

    https://UK.Yahoo.com/ I noticed no problem in the last two sessions, perhaps the problem is resolved, will not display rear reccurrence as appropriate.

  • Edit event managed by this case in LabVIEW 2013 does not show the specifiers of the event, Event Sources and events on screen resolution 800 x 600

    Edit event managed by this case in LabVIEW 2013 shows not specifiers of the event, Event Sources and events on screen resolution 800 x 600.

    As far as I know, the list of supported resolutions is determined solely by the graphics card. It is possible that one used by the PC supports only 800 x 600 as maximum resolution, even if you plug an external monitor.

    Like Dennis suggested, the recommended option would probably be to develop on another PC and only deploy an executable for the industrial PC. That's what we do with our systems (although not because of this problem, but because it makes sense. There absolutely no need to have the IDE installed in most of our systems).

    Other options:

    1. See if you can get an update of the driver from the manufacturer to solve this problem.
    2. Plug a USB Monitor with its own driver.
    3. Try to hide the taskbar and make the smaller title bar in the hope that the bug manifests.
    4. Try remote access in the PC. I think that some remote access programs allow you to specify custom resolutions that are not affected by the original drivers. Remote Desktop seems to be a likely this option even if it has been awhile since I've used it.
    5. Check the BIOS. I saw at least one industrial PC where there was some settings in the BIOS to control the resolution, but I don't remember the details, and it was quite limited. I think that in this case, you can change the resolution, but then the image does not fill the entire screen.
  • Unexpected behavior with several structures of events manages the event itself.

    Hi, does anyone have an explanation of the following behavior?

    After 'Boolean 2' is enabled and then disabled the program "freezes". You can always pause the program but nothing does.
    For example, by pressing one of the file, Edit, View, project, Operate, tools, Windows, help or any other object inside the VI.

    This happens if I have two event structures who want to handle the same event, even if the flat sequence should be allowed only one run.

    This isn't a bug.

    Structures of the event should be used to handle different events. Given that you have entered your Boolean event in the two structures of the event, the event gets queued both when it occurs. This means one or the other be expected to manage the event and will, by default, lock the application. In the scale-measure of LabVIEW architectures, usually there is a structure of single event that handles all the events and then sends messages to the coast to the rest of the application to manage these events.

    There is a "Table locking" checkbox in the event dialog box which is by default enabled, but you should leave it on because it leads to bad practices otherwise.

  • How to manage the events of bps in Application

    the example shows only the event handling in C, such as dialog box.

    I want to run these events bps in my mainApp.

    I find all bps events are managed by BpsEventDispatcher:rocessBpsEvents().

    These events willnot goto request, someone help?

    int cascades_user_main (int argc, char * argv)
    {
    This is where the server is started.
    App app (argc, argv);

    MainApp App;
    QObject::connect (& app, SIGNAL (aboutToQuit ()), & mainApp, SLOT (onUpdate (()));

    Return Application::exec(); Complete us the transaction started in the constructor of the app and begin the loop of customer events here
    When the loop that you exit the Application deletes the stage that removes all his children (by the rules of qt for children)
    not as nice of course
    }

    Here's a code for me to get GPS-events. Should hopefully be the same for other events.

    https://bdsc.webapps.BlackBerry.com/native/reference/com.QNX.doc.screen.lib_ref/topic/rscreen_get_ev...

        LOG_INFO << "use playbook GPS";
        this->screenOrientation = 0;
        bps_initialize();
        LOG_DEBUG << "initialized";
        if ( geolocation_request_events( 0 ) != BPS_SUCCESS )
        {
            LOG_WARNING << "could not request position: " << strerror( errno );
        }
        else
        {
            LOG_DEBUG << "request geolocation events";
            geolocation_set_period( 1 );
            LOG_INFO << "period 1 sec";
    
            LOG_DEBUG << "request orientation events";
            if ( orientation_request_events( 0 ) != BPS_SUCCESS )
            {
                LOG_WARNING << "could not request orientation: " << strerror( errno );
            }
            /*
               sensor_set_rate( SENSOR_TYPE_MAGNETOMETER, 1*1000*1000 );
               sensor_set_skip_duplicates( SENSOR_TYPE_MAGNETOMETER, true );
               sensor_request_events( SENSOR_TYPE_MAGNETOMETER );
             */
    
            if ( sensor_is_supported( SENSOR_TYPE_AZIMUTH_PITCH_ROLL ) == true )
            {
                // every 500 msec should be enough
                sensor_set_rate( SENSOR_TYPE_AZIMUTH_PITCH_ROLL, 500 * 1000 );
                sensor_set_skip_duplicates( SENSOR_TYPE_AZIMUTH_PITCH_ROLL, true );
                sensor_request_events( SENSOR_TYPE_AZIMUTH_PITCH_ROLL );
            }
            else
            {
                LOG_INFO << "SENSOR_TYPE_AZIMUTH_PITCH_ROLL not supported";
            }
    
            QTimer *playbookTimer = new QTimer();
            connect( playbookTimer, SIGNAL( timeout()), this, SLOT( pollPlaybookLocation()));
            playbookTimer->start( 100 );
            LOG_DEBUG << "playbook timer started";
        }
    
    void GPS::pollPlaybookLocation()
    {
        LOG_DEBUG;
        bps_event_t *event     = NULL;
        int         eventCount = 0;
        bps_get_event( &event, 0 );
        if ( event != NULL )
        {
            while ( event != NULL )
            {
                LOG_DEBUG << "event: " << QString::number( eventCount );
                eventCount++;
                if ( bps_event_get_domain( event ) == geolocation_get_domain())
                {
    
  • What is the event when back to summon the Manager

    Hi, I use Invoke Manager to play the video

    What is the event when the invoke handler is close / back-> for my application.

    (I want to analyze how long this user read this video)

    Thank you

    I do not know what past all I KNOW the app called is not informed of which invokes this past that stage of the initial call, therefore no mechanism is a reminder when the application is closed.

    Obviously if you wrote the video player yourself you could invoke back or set up signs saying closed process.

  • Does invalidate a field without a lock of the event, invalidate the field Manager?

    It is probably of a self-inflicted gunshot wound.

    Does invalidate a field without the lock of the event, invalidate the field Manager?

    In other words, if I cancel one or several fields individually, I see any changes made to the zone manager?

    Thank you.

    No, disabling the field does not affect the Manager. You must be confusing with disabling the Manager (repaint all managed fields) or make updateLayout field (including redispositions the display Assembly).

  • Management of the custom event sent by loading SWF fails

    I loaded and SWF using SWFLoader. Not a component, but just a regular Flash AS3 SWF. I can access its properties and functions but when I listen to a custom, event distributes, I get the error:

    Error #1034: Type coercion failed: cannot convert com.subhumanmedia.classes::SoundCueEvent@911ad61 to com.subhumanmedia.classes.SoundCueEvent.

    Here's the event:
    package com.subhumanmedia.classes
    {
    import flash.events.Event;
    SerializableAttribute public class SoundCueEvent extends Event
    {
    public static const = "cueSound" CUE_SOUND:String

    private var soundCueObjectInstance:Object;

    public void SoundCueEvent (type: String, bubbles: Boolean, cancelable: Boolean, soundCueObject:Object)
    {
    parameter soundCueObject:
    soundCueObject.cueSoundURL is the string with the name of file to play
    soundCueObject.cueSoundStartTime is the number giving the millisecond offset to read from
    //
    Super (type, bubbles, cancelable);
    soundCueObjectInstance = soundCueObject;
    }
    public function get soundCueObject (): Object
    {
    Return soundCueObjectInstance;
    }
    override public function clone (): event
    {
    return new SoundCueEvent (type, bubbles, cancelable, soundCueObjectInstance);
    }
    }
    }

    Here is the statement in the loaded SWF, the event:
    dispatchEvent (new SoundCueEvent (SoundCueEvent.CUE_SOUND, true, false, soundCues [cueCounter]));


    soundCues is an attay soundCueObjects.

    Here is the definition of the listener in my main class:
    slide.slideGraphic.swfObject.content.addEventListener (SoundCueEvent.CUE_SOUND, cueSoundHandler);

    And here's the Manager:
    private void cueSoundHandler(e:SoundCueEvent):void
    {
    trace (e);
    }

    If I change the type of parameter of the event Manager, it does not take a mistake, but I can't yet ride a SoundCueEvent event in order to obtain tracking information.

    Now both the right loaded SWF and main class get the definition of the event from a compiled SWC, but I tried several other ways to do it without any better result.

    I don't know even what causes the error and am totally baffled by how to solve it. Can anyone help?

    It is equivalent to the problem of shared code described in the presentation of the modules on my blog.

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

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

  • Question about the events of list management

    I searched in the circles of a response to this problem for a while now.

    Background information:

    I have an application that uses a number of listservs. However, some end users have complained about this particular control since you not only have select from the popup LOV, but you then have to click on the 'Add' button until the selected value will be submitted to the page. They would like me to display some callback types click on 'Add' when a value is selected, but not yet added.

    I found the names of the different elements of the list manager and created a simple javascript function to change the background color of the text box where the selected value is displayed and attached that work to the onchange event.

    My problem is that if something enter the text box fire the onchange event, by clicking on the 'Add' button does not work. In other words, I can put a red background (or whatever I end up doing) if they have not yet added value, but I can't put it right back when the user clicks on 'Add '. The best work around I came uses the list manager onmouseover event, but is not as clean as I like it.

    The 'Add' button has an onclick (obviously) the events that first calls a function "appendToList" and then deletes the text box.

    {color: #0000ff} & lt; "input type ="button"name =" "value ="Add"onclick =" appendToList (return [0].p_v99.value.toUpperCase (), return [0] .p_v04); return [0].p_v99.value = "" / & gt;

    {color} {color: #000000} The appendToList function is defined in the body of the page, just forward to the & lt; fieldset & gt; tag that creates the list manager, leading me to believe that there is a template somewhere.

    Question:

    Is it possible to edit the template for the list manager so that I can call my function when the user clicks on the button "add"?

    or

    Is it possible to redefine the function appendToList somewhere on this page, so I can place a call to function within this function?

    or

    Is there another way to restore the appearance of the text box when the user clicks on the button 'Add' that I thought not again?


    Thanks for any help you can provide. This is bugging me. {color}

    Hello

    I think that what follows may work for you.

    Suppose you have a component called P4_LIST_MANAGER list manager. Add the following code in the Footer area of the region setting:

    <script type="text/javascript">
    var lm = document.getElementById("P4_LIST_MANAGER_ADD");
    lm.onchange = function()
    {
     if (lm.value.length > 0)
     {
      lm.style.backgroundColor = 'red';
     }
    }
    var lmfs = document.getElementById("P4_LIST_MANAGER");
    lmfs.onclick = function()
    {
     if (lm.value.length == 0)
     {
      lm.style.backgroundColor = 'white';
     }
    }
    </script>
    

    The main problem you see is that for an input element onchange event is not raised when its value is changed via javascript on the page. The above assumes that the user has clicked in the area of field set to use either the Add or Remove buttons, and then resets the background color.

    Andy

    Published by: ATD 15 January 2009 19:02

  • How to manage the structure of the event with two loops

    I have a question about the structure of the user event with 2 buttons?

    key 1: START LOGGING DATA

    key 2: STOP LOGGING DATA

    How do I control my

    structure of the event so that it will work? because now that the loop is save data... I can't stop the loop, when I clicked on buttons.

    super_saiyans wrote:

    the problem with moving it is that I don't have control of the DATA RECORD STARTING?

    Of course, you do.  When you get your press conference button, you say your state machine to move to the State of logging.  You must also make sure that you return to visit the State to wait for the event to check out the events of the stop button.

  • Shared management of the Variable - spurious events events

    It is more of a nuisance than anything:

    Thanks to the module DSC to join with variable events shared, the structure of the event fires once for each variable recorded for always. For example, if I sign up for shared variables 'Var2', and 'Var1' entering into the structure of the event [in a loop], I'll immediately see two events [one for Var1] and the other for Var2 even if the values of Var1 and Var2 have not changed.

    Initially, I thought this is intentional - it seems impossible to use the events of the OAS without this "feature" - except that's not switch mode "highlight execution", which I find confusing.

    Why it exist, and is there a magical way to turn it off? Or is this a bug? Anyone ever used SV events no doubt has any means to deal with this. At the moment I just burn the first manifestations of N, where N is the number of shared variables, I am registered for. But who is unwanted additional schema and really, it should not be necessary.


  • service control manager errors 7011, 7034, 7036 and sr 1 in the event log.

    I have problem with mouse (ps/2 compatible laser and wheel mouse optical usb) and / or the keyboard may freeze completely not moving or not to answer. also repeatedly happens a lot or ok for awhile or rarely. the event log which seems to be both what happens or the scm 7011,7034,7036 and, sometimes, the sr 1. No category.  often the only thing to do is to unplug the system and restart. I don't think it's the mouse or the keyboard. I have McAfee antivirus and computer Acer Power. It's pc. This cannot be good on the computer. any ideas?

    Hi no. Ida,

    See the link below to put on with similar problem and try the steps mentioned, check if it helps.

    http://social.technet.Microsoft.com/forums/en-SG/w7itprohardware/thread/cc12ba6b-68e6-430F-949B-b7487cce61b1

    See also the link and run the Fixit tool, check if it helps.

    Hardware devices do not work or are not detected in Windows

    http://support.Microsoft.com/mats/hardware_device_problems

Maybe you are looking for