Keep focus in a control until certain conditions are met?

Hello,
Is there a way to keep focus at a control until certain conditions are met?
For example, if I might want to keep the focus set to a text field inside a tab unless the text field contains something valid.
If user tries to switch to different tab without having valid text inside the text field, I would like to pop up a stage/dialog and abort the tab switching.
Please help!
Thanks.

Hi. Here is an example:
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;
public class SSNValidation extends Application {
    public static void main(String[] args) {
        launch(args);
    @Override
    public void start(final Stage primaryStage) {
        primaryStage.setTitle("SSN Validation");
        Button btn = new Button();
        final TextField tfSSN = new TextField();
        StackPane layout = new StackPane();
        Scene scenePopup = new Scene(layout, 424, 154, Color.TRANSPARENT);
        final Stage stage = new Stage();
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.setScene(scenePopup);
        stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
            @Override
            public void handle(WindowEvent event) {
                tfSSN.requestFocus();
        tfSSN.focusedProperty().addListener(new ChangeListener<Boolean>() {
            public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, final Boolean newValue) {
                if (!newValue) {
                    if (tfSSN.getText().length() < 9) {
                        stage.show();
        final TextField tf2 = new TextField();
        btn.setText("Submit");
        VBox root = new VBox();
        root.getChildren().addAll(tfSSN, tf2, btn);
        primaryStage.setScene(new Scene(root, 300, 250));
        primaryStage.show();
}

Similar Messages

  • RBATP - is it possible to activate them only if certain conditions are met?

    Hello APO - RBATP experts!
    I have a question that I hope you can help me with:
    Is it possible to have rules that become active only in certain circumstances, for example, if the RDD of the sales order is today or tomorrow?
    I have limited knowledge on the topic; so your help will be greatly appreciated.
    This is my scenario:
    A sales order is raised in plant A for Material X, if there isn't enought inventory of Mat. X, there will be a rule to look for inventory in plant B. If stock is found in plant B; then an ATP Tree structure is created, which is then turned into a purch req; and then into an STO from Plant B to Plant A. Then the shipment is sent to the customer from Plant A. This is good, however, this is not what we want for sales orders that are placed with too much time in advance; because by the time the sales order needs to be delivered, the inventory may be available in Plant A, and those requirements are meaningless at that point. Any ideas of how to handle this? Thanks in advance!

    Hi DB:
    Here are my answers:
    If the requirement is placed upon B, how is it possible to later have excess inventory in A? 
    If the sales order was placed let's say 7 weeks in advance; during that time the whse could have received inventory from the plant.
    This is mainly why I need to find a way for the rule to do the substitution and create the requirement in B, only if RDD is very close to today's date.
    Is there a reason why wouldn't ship directly from B to the customer? (instead of first moving the stock to A) 
    Yes there is, the requirement of the business is that any sales order raised in A, must be shipped from A; but stock must be found in alternate locations to satisfy the order. If stock is not found, then the order is cut and shipped.
    Is A a plant, depot, or both?
    Is B a plant, depot, or both?
    How is 'B' normally supplied? 
    Are you using MLATP?  CTP?
    Both are depots; and are supplied from different  manufacturing plants across the country.
    We are using MLATP.
    Thanks again for your input!

  • Restarting the executable until all conditions are true

    I wonder if I could be very clever and find the way out of my problem here.
    I am communicating with a device over UDP and for some reason, the device doesn't often establish communication with my Labview Executable on the first attempt.
    I run it, it fails, I then use CTRL+ALT+Delete to shut it down. I donubleclick the executable ICON on the desktop again and I sometimes do it five or six times then finally the communication is established and it all works.
    I wonder if I could add some code in the application to automate this process. One of the way I could now think to do is by creating another vi and call my current vi dynamically and add all those conditions into cluster, call this cluster (by wiring to the output terminal of the current main vi into new main vi) and monitor my cluster in the new main vi to see if the conditions are true if so continue or reload the current vi until those conditions are met? Is it the right way to do this? Or can I make my life easier and applcation more stable by doing something different?
    Kind Regards Austin

    Can you post your current code and show us the part that is communicating via UDP. I think the way to go is deffinately make your current code stable rather than an automation of failing code.
    Also what is the device you are trying to communicate with. Does this have a set protocol that you need to follow or is it one you are trying to figure out.
    Let us know and we could help you further.
    Matthew Trott
    Applications Engineer
    National Instruments UK
    www.ni.com/ask

  • Does someone know when our movie project and finally our iDVD project is done, can we erase the clip that we had imported in iMovie without danger?  Or we have to keep the clip in iMovie until the DVD are burn?

    Does someone know when our movie project and finally our iDVD project is done, can we erase the clip that we had imported in iMovie without danger?  Or we have to keep the clip in iMovie until the DVD are burn?

    Hi
    Most processes in Non destructive Video editing is based on that the raw-material is safe and intact. So by trashing it most things can or will go wrong.
    So e.g. in iMovie project - there is NO Movie - just a small text document refering to Your raw-material, audio files and photos (within or not in iPhoto Library) on how they are to act together to Play Your Movie.
    And by changing any of them the Movie project will be affected or destroyed.
    reg. iDVD there is also a link back to iMovie - Most famous to set of the iDVD BUG !
    To do that - one starts a new iDVD project and add movies etc. Then find something i one movie in need to be adjusted. Closing iDVD and returning to iMovie and doing this. Then when back to iDVD it will notice and ask You to Up-date or Cancel. Neither works. The iDVD project is harmed. All Chapters now point to Chapter One and more strange things happens.
    the medicine I use - I start a brand new iDVD Project and re-do it and hopefully not fine any more to be fixed in the movie.
    This indicates the strong link inbetween iDVD and iMovie and I would not touch anything in iMovie till DVD is Burned and Ready AND Plays Well !
    Yours Bengt W

  • Hold indicator state if conditions are met for review at end of test

    I am looking to have an indicator stay true if conditions are met. I can get it to go on just not stay on. Example: if 5>0 and 10>0 then true (and stay true until reset. It is probably something really easy and I am just missing it but I am not sure what labview combination of items to make the value stay until reset.

    Paul and IanW,
    I thank you for your posts....I think I have the solution but not sure why it does not work in my application. Attached is Paul's version modified to look like my version but they do not act the same.....My VI was created in 6 and migrated to 7.1 with the upgrades. This is the only thing that I can think of. Does this mean I have to redo my VI in the new version to fix this issue or am I just missing something.
    Thanks,
    Kyle
    Attachments:
    keepBooOn.vi ‏143 KB
    Full Lab_verlatch.vi ‏170 KB

  • Set Cell or Row to read only if certain condition is met

    Greetings,
    As the subject suggest, I need to set Cells or Rows to Read Only or "Gray out" If Certain attribute doesnt contain any value.
    The requirement is to search for records of certain range and display it in the table. And the records will not be editable (read only) if certain attribute/field of the record is NULL. In another words that particular row will be gray-ed out.
    Right now I am able to extract out the range of records out and display it in the table but I am not able to set the display of the records/ rows to read only. Do note only certain row needs to be set to row only depending on a particular attribute.
    I was to code these in WDDOMODIFYVIEW()... anyone have any solution to this? Points will be given of course. ")

    Please dont use the DOMODIFY method for such changes.
    The Properties mapped to the context are designed for exactly this purpose.
    Your context node should be extended with another attribute. Eg attr_y_Read_only.
    The read_only or enabled attribute of field y would then be mapped to this attribute.
    Depending on cell editor type it may be called enabled or read only.
    You then set this new attribute to true or false appropriately for each element in the node.
    This new attribute, although inside the node, need not be displayed as part of the table.
    It is there to help control fields in the each element.
    Regards
    Phil.

  • How to automatically reply to requestor when certain condition is met on a form

    Just got SP 2013 and was hoping I could automate something. We have a form that a requestor fills out. At some point, that form will be marked "Received" or "Complete". I was hoping whenever those changed (went from nothing to received......nothing
    to complete.....received to complete.....complete to received) that the requestor would automatically notified of the change via e-mail.
    Such as...I mark is as complete. SP send the requestor an email saying "Your request has been completed" with a link to the original form.
    Is there a way to make this happen or will I need additional components to make this happen? Im looking into downloading SP Designer, but since its for work, not sure if that will be well-received or not.
    Thanks

    You can create a custom workflow based out of SPD and fire the workflow when the form is marked as Received and Complete.
    it would require
    just two steps -
    1. If Condition
    2. send an email action in SPD
    here are some references -
    http://msdn.microsoft.com/en-us/library/office/jj163272.aspx
    http://msdn.microsoft.com/en-us/library/office/jj164026.aspx
    http://msdn.microsoft.com/en-us/library/office/jj822976.aspx
    Hope this helps!
    MCITP: SharePoint 2010 Administrator
    MCTS - MOSS 2007 Configuring, .NET 2.0
    | SharePoint Architect | Evangelist |
    http://www.sharepointdeveloper.in/
    http://ramakrishnaraja.blogspot.com/

  • How do I add cells, but only if certain criteria are met first in other cells?

    I have a little problem in working this out, I can't! I can add cells & alike, but more complex working are an unknown to me.
    Any help here would be greatly appreciated.
    I've three cells in a row C4 with 5 in, D4 with 3 in & E4 with 1 in. I'd like to add these numbers together into a cell below E6, which is =SUM(C4:E4) which will make 9 in cell E6.
    I've also three cells in a row below C4 - E4 which are C5, D5 & E5 which will only ever have ether 0 or 1 inputted into them. All these cells will only ever have data inputted into them from left to right i.e. Column C first, then Column D & lastly Column E.
    What I’d like for the cells to do, is only add cells C4 - E4 from left to right, once a cell below (C5 - E5) has had a 1 inputted into it & then continue to add the cells there after normally.
    Examples:
    Like above if C4 had 5, D4 had 3 & E4 had 1, & the all the cells below (C5 - E5) had 1 in them, then E6 = 9.
    Again,  if C4 had 5, D4 had 3 & E4 had 1, but C5 had 0, D5 had 1 & E5 had 1, then E6 = 4.
    Again if cells C4 - E4 are the same, but C5 had 0, D5 had 1 & E5 had 0, then E6 still = 4.
    In the same aspect as above, if C4 - E4 are the same, but C5 had 1, D5 & E5 had 0, then E6 = 9.
    If cells C4 - E4 are the same, but C5 - E5 all had 0, then E6 = 0.
    I hope this is clear, & all comments are welcome.
    Many Thanks.

    Big_Botts wrote:
    Hi Barry,
    Just a thought, Wayne is helping me on another question I asked, do you think you could help?
    https://discussions.apple.com/message/17950789#17950789
    Wayne's got that one well in hand. Nothing to add there, except that you'll find the details about conditional formatting in the Numbers '09 User Guide, which can be downloaded via the Help menu in Numbers. While you're there, grab the iWork Formulas and Functions User Guide as well. Both are quite useful.
    Regards,
    Barry
    Regards,
    Barry

  • Quick question - making button visible if two conditions are met

    I simply want a button to be visible is once condition is true and another condition is false. Shouldn't this line of code work?
    <mx:Button id="Btn"label="
    Submit"color="
    #FF0000"enabled="
    {islRequired}" visible=" 
    {!.isAdmin}  {isRequired}"
    click="submit()" 
    />
    isadmin = false
    isrequired = true
    the button should be visible
    Am I missing something?

    Maybe you miss OR (||) or AND (&&), but I never use at mxml
    visible="{!.isAdmin && isRequired}" 
    Works?
    Best Regards,
    Miguel

  • Hiding Button if Conditions are met

    I have a form that has 3 drop down boxes with options 1,2 and 3 in them.  I want to hide a button if "1" is selected for either of the 3 drop down boxes.  But the problem is I want it to re appear if the user changes their mind and wants to select 2 or 3.  So at no point and time do I want the button visible if "1" is selected.  But I do want it visible if  none of the boxes have "1"or are blank.
    Thanks in advance for taking the time to help.

    Hi uschad123,
    Here's a way to do it:
    Set the bound values as numbers: 1,2,3 in the Binding Tab of the Object Pallet
    then using formCalc you put a script "like" this on the "exit" event on all 3 drop-down boxes:
    ////////////////////// formCalc:
    if ($ le "1" | ddl2 le "1" | ddl3 le "1") then
         button1.presence = "hidden"
    else
         button1.presence = "visible"
    endif
    you'll need to adjust the script slightly for each drop-down box. My example uses formCalc, but javaScript is just as easy.
    ////////////////// javascript:
    if (this.rawValue <= "1" || ddl2.rawValue <= "1" || ddl3.rawValue <= "1")
          button1.presence = "hidden";
    else
         button1.presence =  "visible";
    also with this, you'll need to adjust the script slightly for each drop-down box.
    Good luck,
    Stephen

  • Write to new spreadshee​t each time condition is met.

    Hi guys, I am currently in the final stage of the project thanks to those who helped me along the way, but i have one more "riddle" to solve...
    I am currently writing all the data collected into the spreadsheet by using write to spreadsheet, but i would like to actually have a different spreadsheet file each time a certain condition is met, is it possible to do it?
    Thanks in advance.
    i have attached my VI below for a clearer view.
    Attachments:
    SERIAL AND TCP DATA RECEIVING FINAL.vi ‏257 KB

    Hi Simmy,
    you could use a counter and if the condition is true you can increase it.
    Mike
    Message Edited by MikeS81 on 05-27-2008 08:46 AM
    Attachments:
    Unbenannt1.PNG ‏10 KB

  • How to prevent the backspace conditionally. if no focus in any control in the document ?

    I prevent a backspace button conditionally using confirm box. i used event.preventdefault() method to stop the event of i press ok in the conform box.
    But it works when the focus is on either input or text area elements.
    if there is no focus in these controls the browser redirects to previous page.
    i need your help..
    thanks in advance !

    Hi dineshkumar,
    Thank you for your question. I understand that there are some default hot keys that are not being prevented in a web page unless they are focused in an input html tag. I do not know if this is for a website you developed or if this is for all websites, but:
    If it is for all websites: you can use a key configuration to change it only in Firefox [http://kb.mozillazine.org/Keyconfig_extension]
    If it is in a website:
    *Please see the MDN article for more information on the Javascript call you are using: [https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault]
    *Here is a relevant stack overflow question: [http://stackoverflow.com/questions/1357118/event-preventdefault-vs-return-false]
    Thank you and we hope this helps.

  • Inserting paragraphs into a report based on a certain condition

    Hi, I need some advice on the best method to insert paragraphs of text into a report.
    I have +/- 100 paragraphs which are in text format, I need to insert these into the report based on certain conditions.
    I have tried entering them into the trailer section one after the other and using conditional formatting to display them if the the condition is met. This works well but I ran out of space in the trailer section.
    I then thought of saving the paragraphs somewhere on the server as seperate txt files and inserting them into the report using file links,
    or I could put these paragraphs into a table and then insert them from there, some of these paragraphs are longer than 4000 characters,
    Please advise on the best method
    Thank you
    Michael

    Hi,
    If the button and the textfield are on in the same subform then this code should work in the click event of the button
    (This is JavaScript code so make sure the code is set to JavaScript and Client on the drop downs in the script window)
    (assuming the name of the textfield is TextField1)
    TextField1.rawValue = "some value";
    If they are in different subforms then you have 2 options
    Please note in both these options it is easier if the subforms have names ( I am assuming this to keep samples simple)
    option 1 -
    use the parent object to move up the tree till you are at the same level as that of the subform that contains the textfield
    e.g. 
    (Click Event of the button)
    this.parent.subformname.TextField1.rawValue = "some value";
    option 2 -
    Use the resolve node to make your way down from the top level of the form
    xfa.resolveNode ("form1.subformname.TextField1").rawValue = "some value";
    Hope this helps
    Malcolm
    p.s. I am making assumptions as the image/file you attached did not appear for me.

  • Skip product allocation under certain conditions

    Hi everyone. We are trying to use EXIT_SAPLQUOT_001 which is supposed to be running prior to product allocation, so we can set up parameter E_AFLAG so that this functionality is skipped under certain conditions.
    Exit documentation says:
    User Exit: SD Product Allocation, Enhanced Checks
    Functionality
    The user exit is called up before reviewing the confirmed quantities against discrete allocations (from 3.0F).
    Before this happens, the availibilty check is carried out if this is switched on in Customizing (ATP or against pre-planning). The results of this are transferred to product allocation.
    You can carry out the following tasks with this function module:
    1. You can switch off or miss out product allocation (E_AFLAG). This can be general or depending on characteristic values. Other values to help make this decision can be imported from the order coding memory.
    However, the exit doesn't seem to be triggered during sales order processing. It takes us straight into the product allocation screen, ignoring the breakpoint and the skipping instruction.
    Any ideas? Anybody is using this exit for this purpose? We run product allocation without running ATP. Could this be the problem?
    Thanks!

    sounds like this the problem.
    as I understand,
    if running ATP, EXIT_SAPLQUOT_001 is hit, based on your logic, prod alloc is skipped.
    elseif ATP is turned off, EXIT_SAPLQUOT_001 is skipped, by default prd alloc is executed.
    try setup break points on prod. alloc to see if you could have alternative flag to control...
    go to debug mode and check call stacks to find another place to set break point.

  • VT02N - do PGI and Invoice for certain deliveries either based on certain conditions

    Hi Friends ,
    We are using VT04 for creating shipments . While shipment completion stage in VT02N   an activity profile has been maintained  which does both the Goods issue and Invoice.
    We have a business requirement , PGI and Invoice should be created only for specific set of deliveries based on certain conditions.
    Is there any standard way to do this or by using user exits.
    Please guide.
    Thanks,
    Nileshsa.

    what about adding a check in userexit RV60AFZZ, when the condition is not met during invoice creation, error out and disable the creation of the invoice document?

Maybe you are looking for