How to intercept property changes in subclassed control?

I've got an application in Flex 1.5 that uses constants
stored in XML files (see attached). The XML files are loaded into
mx:Models and used as dataProviders on ComboBoxes with "abbr" as
the labelItem. The business objects store only the numeric ID of
the constants. When a business object is loaded, I need to set the
selectedItem of the ComboBox using the numeric ID but I can't
because it doesn't match the items in the dataProvider.
Is it possible to intercept the selectedItem property change
and process the dataProvider items in order to compare the numeric
values instead of having to process it in a function outside of the
control itself? I'd like to write this code only once.

Okay, instead of trying to do any magic with property
changes, I decided to just create my own property (selectedValue).
When this property is set, it iterates through the dataProvider and
finds the index of the item that matches. The selectedValue
property sets the value of selectedIndex to that item.

Similar Messages

  • How to intercept style changes in skin for spark Button?

    How to intercept style changes in skin for spark Button?
    Thank you.

    How to intercept style changes in skin for spark Button?
    Thank you.

  • Dynamically changing width of controls

    hi,
    how to achieve dynamically changing width of controls on a webpage? For example, the width of a button should be according to the length of its caption... Thanks, Girish

    thanx for help, Samir! what I want exactly is: vary the width of controls on the screen. for example, if I have two buttons named "assignment" and "help", I want the width of the buttons to be different (and be proportionate to) as per the length of the caption. what kind of JavaScript code shoud I write to achive this? Pls help out... thanks,Girish

  • How can I make a global change so all controls and indicators labels on the front panel change to another colour?

    How can I make a global change so all controls and indicators labels on the front panel change to another colour?
    I need to change the front panel so that it can be used in a dark environment.

    Hi
    The only way I see, is to use the "Controls[]" property and iterate through all of them. But don't forget about nested elements (i.e. clusters, tab-controls, ...).
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

  • How to intercept a dataTips 'show' event (list control)?

    Hi people,
    I'm using  a list control with showDataTips property set to true, so as dataTips are automatically displayed when the text is too long for the row. The point is that I need to preserve this condition (i.e. I don't want dataTips to be displayed when the row entirely contains the text) but my goal is to delegate the datatips 'show' event to another control. However I cannot figure out how to intercept that event. As any UIComponent the list control dispatches a toolTipShow event but this doesn't regard dataTips
    I suppose I could just disable showDataTips and implement my own logics using the itemRollOver event. But, in that case, how to check whether the text is too long for the row?
    Thanks for any help,
    @+
    Marc

    You'd be better off posting this in the developer forums : https://devforums.apple.com/index.jspa

  • How does referencing a property of top-level control effect a sub-VI's timing?

    I've got a Graphic User Interface (GUI) with some buttons and text controls. First I bundle the references to these controls into a cluster and send it to a utility sub-VI where the cluster is saved in a switch register (the process called functional global). Then I have a 10 Hz loop in the GUI VI to monitor the controls locally. In a separate loop, I start a sub-VI that eventually leads to the utility sub-VI with the control references. When I use these references with the "Property | Value" it seems to effect the timing of the sub-VI.
    Currently I'm running the entire application using LabVIEW's default priority and execution system. It appears that when the sub-VI encounters the Property Node reference to an external control, the sub-VI loses its place at the head of the CPU queue, thus allowing other VI's to process.
    I'm considering assigning the utility sub-VI a higher priority and/or execution system but I'm not sure of the ramifications. I've read Application Note 114, "Using LabVIEW to Create Multithreaded VIs for Maximum Performance and Reliability", but it's dated July 2000 and does not seem to cover Property Nodes.
    Is there a connection between using Property Nodes for external controls and system timing or is my testing flawed?

    Property nodes and the VIs which use them all are forced to run in the User Interface execution system. This is what causes the change in your VI timing.
    To change the value of an indicator without "moving" the subVI to the UI execution system, try passing the data to the GUI VI by means of a queue. This should allow updates without waiting for the subVI to finish and without causing the slowdown. The Enqueue qnd Dequeue functiosn are quite fast so the added ovehead should have minimal effect on your timing.
    Lynn

  • How: Using the same control panel for multiple vi and propogatin​g changes to the control panel.

    I have created a labview project that contains about 40 vi.  Each vi has a control panel in common that is a group of ip address, or port address, and settings that are passed from high level vi to low level vi for the purposes of controlling and accessing our daq cards.  As this control panel exist in all vi's and is required to be identical there is a problem when needing make a change or update the controls during development.  The problem is how much time it takes to go and change every single vi's control panel.  I wish to have a way of propogating a change in the control panel across all vi simultaneously.
    All control in the control panel are in a bundle, so all values are passed in 1 wire. 
    I tried turning the control panel into a sub vi, and this way I can just "create control" and have outputs of the vi maniuplate settings, however if I update the vi, I still have to go back and create a new control for each vi as the control has changed.
    I have tried using the subpanel and creating the control panel in a sub vi that is displayed in the subpanel, but this gives the unwanted consequence of not being able to view or change settings on the control panel if the program is not running, as subpanels blank out when the program is not running.
    Is there another way to dispaly a subvi's front panel beside using a sub panel?  Is there a better way to propogate changes in a bundle throughout a series of vi? 
    JW
    Solved!
    Go to Solution.
    Attachments:
    Labjack Comm Settings.vi ‏15 KB

    Yes a type def would help you out and I'd take the next step to make it a strict type def if you want the appearence to be the same across all of its instances. You can also review this Nugget on Type definitions for more idea on this topic.
    Have fun,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to force updatedisplaylist in a skin when custom property changes

    Hi Folks,
    I have created a custom component based on a Spark Button.  In that custom component I have added a single, public, bindable property - let's call it Fred.
    I also have a custom skin, based on the Spark Button skin.  It's basically just like the delivered skin, just a bit different graphics stuff.  I have applied the custom skin to the custom button component.  So far, so good.  However...
    When a user action causes the Fred property to change on a custom button instance, I need my custom skin to re-draw something.  It appears that I need the skin's updateDisplayList function to fire.  Unfortunately, it appears that the only time that it fires is when "real" properties are changed, like 'left' or 'width'.  How can I get the custom skin to updateDisplayList when this fake, custom property changes?
    p.s. - the custom skin can 'read' the custom Fred property just fine.  And, if I set the Fred property and then 'mouse over' the custom button instance, the updateDisplayList fires...too late of course, but it does fire.
    I have read the docs, but there is not much written about updateDisplayList, or when it fires, or how to make it fire.
    Thanks,
    -David

    Good question...in my skin's 'creationComplete' event I call a function in the skin.  That function 'evaluates' the host component's Fred propertey, and based on what it finds, it draws some stuff:
    protected function doSpecialDrawing():void
         var hostFred:String = hostComponent.Fred;
         if (hostFred == "certain_value")
              //set some property in one of the path objects in my skin to a certain value
         else if (hostFred == "other_value")
              //set some property in one of the path objects in my skin to some other value
    When I created the skin, I did not anticipate the need to dynamically respond to setting the Fred property/value.
    I've placed a call to the 'doSpecialDrawing' function inside the skin's updateDisplayList, but unfortunately, the updateDisplayList does not seem to get called in real-time when I set the Fred property in a custom button instance.
    I'm all ears here... still a beginner/novice with Flex...
    Thanks,
    -David

  • Volume control: I cannot change the volume using the keyboard of my Macbook. I have to go into preference. How to come back to the keyboard controler.

    I cannot change the volume using the keyboard of my Macbook. I have to go into preference. How to come back to the keyboard controler.

    1. Reset PRAM.  http://support.apple.com/kb/PH4405
    2. Reset SMC.     http://support.apple.com/kb/HT3964
        Choose the method for:
        "Resetting SMC on portables with a battery you should not remove on your own".

  • How to maintain open change request control for the transaction MM02 & CS02

    hi all...
    can any one please let me know that, is there any BADI or Enhancement spot
    where i can code for my desired functionality...
    how to maintain open change request control for the transaction MM02 and CS02.
    Desired Functionality:
    • The user wants to maintain a material, bill of material or a document.
    • On the initial screen of the respective transaction (MM02, CS02)
      user enters a change request number.
    • The system checks whether the object record that the user wants to maintain
      is already assigned to other change request numbers.
    • If this is the case, the system displays a warning, stating that there are
      other open change requests for this master data record.
    • In addition, the system lists the relevant change request numbers.
    • The user can continue the maintenance or leave the transaction and first check
      the mentioned change requests.

    hi satish thanks for reverting back
    but sorry yaar given enhancement is not triggering...
    but my requirement is:
    - after executing the transaction MM02 & CS02.
    - user inputs the data for Material Number and then he enters the Change Number.
    - if the given Change Number is not maintained with the Material (i dont no
      where/how this two fields are maintained internally), then it has to raise a
      warning and it should list the existing Change Numbers for that perticular
      Material.

  • Every time I change password access control to allow access, it reverts after saving. How do I get the saved change to "take"?

    Outlook keeps asking me to either use the login keychain or to use confidential information connected with my email password. I went into the keychain passwords in KeyChain Access, changed the access control on each of them to allow Outlook access. I saved the changes, but then they all reverted to their previous setting.
    There is an older Keychain Access file in the Control Panel that will not open because it's either "damaged or corrupted". If I delete that, would it make a difference? What can I do to keep my access control changes when they won't stay saved?

    I do not have the disc to reload
    Why not?  You need your system dvds to troubleshoot & to reset/change passwords in view of your current OS listed in your  profile. 
    You can get replacement System Install & Restore CD/DVDs from Apple's Customer Support - in the US, (800) 767-2775 - for a nominal S&H fee. You'll need to have the model and/or serial number of your Mac available.
    If you're not in the US, you may need to go through the regional Apple Store that serves your location to find the contact number. Here's a list of links to all of those - http://store.apple.com/Catalog/US/Images/intlstoreroutingpage.html Another resource:  International Support Phone #s.
    ===============
    I have to have the password, which I cannot remember or find.
    When selecting passwords, make sure it's one that you will NEVER forget AND no one else can figure out. 
    Old school--- > Print it out & keep in a safe place.  A place that ONLY you know about AND never forget.
    New school---> Get a password manager utility.  Highly recommend 1Password which is shareware.  Do a Google search for free password managers.

  • Property binding between custom control and its aggregations

    Hi,
    I have a custom control with some properties, e.g., visible, and I would like to bind these properties to its aggregated controls without losing the two-way binding functionality. For example, imagine the following control:
    sap.ui.core.Control.extend('dev.view.control.MyControl', {
      metadata: {
        properties: {
          'visible': {type: 'boolean', defaultValue: false},
        aggregations : {
          _innerTable : {type : 'sap.m.Table', multiple : false, visibility: 'hidden'}
    So in this example, I would like to bind the "visible" property of the _innerTable to the "visible" property of MyControl without losing two-way binding. That means that I do not want to read the "visible" property once in a constructor or so and set it on the inner table. Instead I want _innerTable to react on changes of the "visible" property of MyControl so that I can bind it, for example, with "visible={/model/visible}" on an instance of MyControl and _innerTable changes when the model changes.
    Does anyone know if such a "piping" or "chaining" of properties is possible and how it would be done?

    It's close to my case, but you pass the label to your custom control from outside, where you also perform the data binding. In this case, you know which path should be bound to the label property.
    In my case, the control is hidden inside my control, so I do not know which path from the model should be bound to the inner control. I want to somehow connect the property of my control with the property of the inner control.
    So taking part of your example, the control would look like:
    sap.ui.core.Control.extend('xcontrol', {
      metadata: { 
        properties: {
          'visible': {type: 'boolean', defaultValue: true}
        aggregations : { 
          _header : {type : 'sap.m.Label', multiple : false, visibility: 'hidden'}
      init: function() {
        this.setAggregation('_header', new sap.m.Label({
          visible: <????>
      renderer: function(oRm, oControl) {
        oRm.write("<div");
        oRm.writeControlData(oControl);
        var header = oControl.getAggregation('_header');
        if (header) {
          oRm.renderControl(header);
        oRm.write('</div>');
    At point <????> I want to somehow bind the visible attribute of the label to the visible property of xcontrol without losing the two-way binding, i.e., the label should react on changes of the visible property just like xcontrol would.

  • RM-30410: Warning: Single Record property ignored for non-control block

    Hi gurus,
    I have one block, as oracle default behavious is that when any user enters record and during that if he/she hits down arrow key then it gets to next new record, i want to prevent this behaviour.
    In other words i want that user should not enter second record and if he or she needs to enter second record after saving first then user can only do if he navigate to the form second time.
    In property pallete i put yes to single record but when i compile the form it gives me following warning
    FRM-30410: Warning: Single Record property ignored for non-control block Employees
    Created form file C:\my_forms\employees.fmxPlease seeks help that how can i sort it out.
    Thank you
    Hina

    if he/she hits down arrow key then it gets to next new record, i want to prevent this behaviour. Change the block's key-down and/or key-nxtrec trigger to
    begin
      null;
    end;(or give the user a message "Key not allowed here").

  • Task callbacks on property changes?

    It is possible to have a callback method on a Business Process which will capture a change in a Task property? Or can it only be captured for Task State changes?
    This link addresses adding of callback methods:
    http://e-docs.bea.com/wli/docs81/worklist/advanced.html#1076366
    …as quoted from the above link…
    <You can extend Task controls with callback methods to report state or property changes, or events.>
    … so I would think I could capture property changes not just state changes.
    Looking here
    http://e-docs.bea.com/workshop/docs81/doc/en/integration/javadoc-tag/jc/worklistcontrolannotations.html
    …the only annotation I can see that is related to callback is the jc:task-event annotation.
    And drilling down to the jc:task-event.
    http://e-docs.bea.com/workshop/docs81/doc/en/integration/javadoc-tag/jc/task-event.html
    …all events seem to relate to a state change.
    So is there a way to capture property changes in a callback...if so, how?
    Thank you
    Gerry Rodman

    It is possible to have a callback method on a Business Process which will capture a change in a Task property? Or can it only be captured for Task State changes?
    This link addresses adding of callback methods:
    http://e-docs.bea.com/wli/docs81/worklist/advanced.html#1076366
    …as quoted from the above link…
    <You can extend Task controls with callback methods to report state or property changes, or events.>
    … so I would think I could capture property changes not just state changes.
    Looking here
    http://e-docs.bea.com/workshop/docs81/doc/en/integration/javadoc-tag/jc/worklistcontrolannotations.html
    …the only annotation I can see that is related to callback is the jc:task-event annotation.
    And drilling down to the jc:task-event.
    http://e-docs.bea.com/workshop/docs81/doc/en/integration/javadoc-tag/jc/task-event.html
    …all events seem to relate to a state change.
    So is there a way to capture property changes in a callback...if so, how?
    Thank you
    Gerry Rodman

  • ObservableList: notification on property changes of contained elements?

    Assume we have a list of Persons shown in a ListView. The "renderer" (aka: ListCell) shows them in the format:
    Jonathan Giles (23)
    On changing the age (oops, made him to young/old?), in the person object that list is not updated.
    That's probably because the "atomic unit" is the item, listeners on ObservableList are notified when items are replaced/removed/added, but not on changes to the item. Quick testCase:
    ObservableList<Person> persons = Person.createPersonList();
    final Point counter = new Point();
    ListChangeListener<Person> listener = new ListChangeListener<Person>() {
        @Override
        public void onChanged(Change<? extends Person> c) {
            counter.x++;
    persons.addListener(listener);
    persons.get(0).setAge(50000);
    assertEquals("expect notification on any property change", 1, counter.x);Now I'm struggling with implementing something along an ObservableList which listens to its items - but can't find a way to listen to all properties of a "bean" in a general way. In a Swing ListModel, I would do something like:
    class ListModel<T extends Bean> extends AbstractListModel<T> {
            public void add(T bean) {
                  beans.add(bean);
                  bean.addPropertyChangeListener(getBeanListener());
                  fireIntervalAdded(...);
            protected PropertyChangeListener getBeanListener() {
                 if (beanListener == null) {
                        beanListener = new PropertyChangeListener() {
                                  @Override
                                  public void propertyChanged(...) {
                                       fireContentsChanged(...);
                return beanListener;
    } How can achieve something similar in fx?
    Thanks in advance
    Jeanette

    First, my thoughts on this.
    -- If the Person class is to be monitored for changes, it should be an ObservableValue. I opted to extend ObjectProperty as most of what is needed is already implemented there.
    -- For the vast majority of use cases, the state of items in a ListView doesn't change during the lifetime of the ListView. So I consider it an acceptable solution to add listeners for the specific case where the ListView needs to update its display instantly on change of any of the items' internal state.
    -- This isn't in any way complete, just the latest of many approaches I played with.
    -- It's probably too long and too many files to be considered an SSCCE : - )
    <tt>Person.java</tt>
    import javafx.beans.property.IntegerProperty;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.StringProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.InvalidationListener;
    import javafx.beans.value.ObservableValue;
    public class Person extends ObjectProperty<Person> {
      private StringProperty name = new StringProperty();
      private IntegerProperty age = new IntegerProperty();
      public Person(String name, int age,
              InvalidationListener<Person> invalidationListener) {
        this(name, age);
        addListener(invalidationListener);
      public Person(String name, int age) {
        this.name.set(name);
        this.age.set(age);
        ChangeListener<Object> changeListener = new ChangeListener<Object>() {
          @Override
          public void changed(ObservableValue<? extends Object> observable,
                  Object oldValue, Object newValue) {
            fireValueChangedEvent();
        this.name.addListener(changeListener);
        this.age.addListener(changeListener);
      public StringProperty nameProperty() {
        return name;
      @Override
      public String getName() {
        return this.name.get();
      public void setName(String name) {
        this.name.set(name);
      public IntegerProperty ageProperty() {
        return age;
      public int getAge() {
        return this.age.get();
      public void setAge(int age) {
        this.age.set(age);
      @Override
      public String toString() {
        return name.get() + " - " + age.get() + " years";
      @Override
      public Person get() {
        return this;
      @Override
      public Person getValue() {
        return this;
    }<tt>ObservableListWrapperEx.java</tt>
    import com.sun.javafx.collections.ObservableListWrapper;
    import java.util.List;
    import javafx.collections.FXCollections;
    import javafx.collections.ListChangeListener.Change;
    public class ObservableListWrapperEx<T> extends ObservableListWrapper<T> {
      public ObservableListWrapperEx(List<T> list) {
        super(list);
      public void callObservers(final int index) {
        callObservers(new Change<T>(this) {
          @Override
          public int getFrom() {
            return index;
          @Override
          public int getTo() {
            return index;
          @Override
          public List<T> getRemoved() {
            return FXCollections.emptyObservableList();
          @Override
          public boolean wasPermutated() {
            return true;
    }<tt>ListDataChangeDemo/java</tt>
    import java.util.ArrayList;
    import javafx.application.Application;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.InvalidationListener;
    import javafx.beans.value.ObservableValue;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Pos;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ListView;
    import javafx.scene.control.TextBox;
    import javafx.scene.layout.FlowPane;
    import javafx.scene.layout.Pane;
    import javafx.scene.layout.VBox;
    import javafx.scene.text.Text;
    import javafx.stage.Stage;
    public class ListDataChangeDemo extends Application {
      private ObservableListWrapperEx<Person> data =
              new ObservableListWrapperEx<Person>(new ArrayList<Person>());
      private ListView<Person> listView = new ListView<Person>(data);
      private TextBox nameTextBox = new TextBox();
      private TextBox ageTextBox = new TextBox();
      private InvalidationListener<Person> invalidationListener =
              new InvalidationListener<Person>() {
                @Override
                public void invalidated(ObservableValue<? extends Person> personValue) {
                  data.callObservers(data.indexOf(personValue.getValue()));
      public static void main(String[] args) {
        Application.launch(args);
      @Override
      public void start(Stage stage) throws Exception {
        data.add(new Person("John", 32, invalidationListener));
        data.add(new Person("Mary", 24, invalidationListener));
        data.add(new Person("Jane", 30, invalidationListener));
        data.add(new Person("Teddy", 40, invalidationListener));
        listView.getSelectionModel().selectedItemProperty().
                addListener(new ChangeListener<Person>() {
          @Override
          public void changed(ObservableValue<? extends Person> observable,
                  Person oldValue, Person newValue) {
            if ((newValue == null)) {
              nameTextBox.clear();
              ageTextBox.clear();
            } else {
              nameTextBox.setText(newValue.getName());
              ageTextBox.setText(String.valueOf(newValue.getAge()));
        VBox vBox = new VBox(5);
        vBox.getChildren().addAll(listView, inputPane(), buttonPane());
        Scene scene = new Scene(vBox);
        stage.setScene(scene);
        stage.setVisible(true);
      private Pane inputPane() {
        FlowPane pane = new FlowPane();
        pane.setAlignment(Pos.CENTER);
        pane.getChildren().addAll(new Text("Name:"), nameTextBox,
                new Text("        Age:"), ageTextBox, new Text("years"));
        return pane;
      private Pane buttonPane() {
        Button updateButton = new Button("Update");
        updateButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int index = listView.getSelectionModel().getSelectedIndex();
            if ((index != -1)) {
              Person person = data.get(index);
              person.setName(nameTextBox.getText());
              int age = person.getAge();
              try {
                age = Integer.parseInt(ageTextBox.getText());
                person.setAge(age);
              } catch (NumberFormatException nfe) {
                ageTextBox.setText(String.valueOf(age));
              person.setAge(age);
        Button addButton = new Button("Add New");
        addButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            try {
              int age = Integer.parseInt(ageTextBox.getText());
              Person person = new Person(nameTextBox.getText(), age,
                      invalidationListener);
              data.add(person);
              listView.getSelectionModel().select(person);
            } catch (NumberFormatException nfe) {
              ageTextBox.setText("");
        Button removeButton = new Button("Remove");
        removeButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int index = listView.getSelectionModel().getSelectedIndex();
            if ((index != -1)) {
              data.remove(index);
              listView.getSelectionModel().clearSelection();
        FlowPane pane = new FlowPane(10, 10);
        pane.setAlignment(Pos.CENTER);
        pane.getChildren().addAll(updateButton, addButton, removeButton);
        return pane;
    }Comments and criticism welcome.
    db
    Edited by: Darryl Burke -- no smileys, fine, but at least my text shouldn't disappear!! </rant>

Maybe you are looking for