SetFocus in a control by default during pageload

Hi,
I am using flex builder 2.0. I want to setFocus on a textbox
during pageload.
I have tried to setocus on that control in the below two
event's of a application object
1. CreationComplete
2. Activate
But Cursor is not getting focus on that control after page
load. When I have clicked the application
using mouse then only that page is getting activation
(Or)
I have to press the tab to activate the page.
Initially the browser controls(addressbar etc) are getting
focus instead of webpage.
How to overcome this issue. I want to setFocus after page
loaded by Default on a particular control.
Can anybody help me.
Thanx in advance.
With Regards,
Mahendiran.K

MahePya,
First the credit goes to the gentlemen in the comments below.
First, create a new folder in your Application called
"actionScript". Then RIGHT CLICK the new folder you just created
and create a NEW "ActionScript File". The FILENAME with my example
must be "JavaScript", then click FINISH. Then COPY and PASTE the
code below (please be sure to include the credit) and paste it into
the JavaScript.as file you just created.
STEP ONE: SELECT AND COPY THE CODE BELOW...
/* JavaScript: A MXML component for embedding Javascript in
container HTML
* Author: Abdul Qabiz ([email protected])
* Date: June 16, 2006
* Version: 0.1
* Copyright (c) 2006 Abdul Qabiz (
http://www.abdulqabiz.com)
* Permission is hereby granted, free of charge, to any
person obtaining a
* copy of this software and associated documentation files
(the "Software"),
* to deal in the Software without restriction, including
without limitation
* the rights to use, copy, modify, merge, publish,
distribute, sublicense,
* and/or sell copies of the Software, and to permit persons
to whom the
* Software is furnished to do so, subject to the following
conditions:
* The above copyright notice and this permission notice
shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER
* DEALINGS IN THE SOFTWARE.
// This script sets the browser focus
package actionScript
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.net.*;
import mx.core.IMXMLObject;
[DefaultProperty("source")]
public class JavaScript extends EventDispatcher implements
IMXMLObject
private var _source:String;
private var _initialized:Boolean;
public function JavaScript()
public function set source(value:String):void
if (value!=null)
_source = value;
var u:URLRequest = new URLRequest ("javascript:eval('" +
value + "');");
navigateToURL(u,"_self");
public function initialized(document:Object, id:String):void
_initialized = true;
STEP ONE: SELECT AND COPY END JUST ABOVE HERE!!!
Then SELECT and COPY the following code and PASTE it into the
opening tag of the mxml file that has the TextBox that you want to
give focus. Fore example if the TextBox is in your main
Application, then it should go into the opening tag of that file.
If the TextBox is in a separate component it should go into the
opening tag of that component. Here's the code...
STEP TWO: SELECT AND COPY THE CODE BELOW...
xmlns:actionScript="actionScript.*"
creationComplete="setBrowserFocus();"
STEP TWO: SELECT AND COPY END JUST ABOVE HERE!!!
Next SELECT and COPY the code below and PASTE it just after
the opening tag where your TextBox is located. Again if your
TextBox is located in your main Application file then simply PASTE
this code right after the the close of the Application tag. If your
TextBox is located in a different mxml file then place the code
after the opening tag in that file.
STEP THREE: SELECT AND COPY THE CODE BELOW...
<mx:Script>
<![CDATA[
import flash.external.ExternalInterface;
private function setBrowserFocus():void
ExternalInterface.call ("setBrowserFocus");
usernameTextBox.setFocus()
]]>
</mx:Script>
<actionScript:JavaScript>
<![CDATA[
function setBrowserFocus()
Main.focus();
]]>
</actionScript:JavaScript>
STEP THREE: SELECT AND COPY END JUST ABOVE HERE!!!
The next step is to CHANGE the ID "usernameTextBox" in the
setBrowserFocus function to YOUR TextBox ID and it should work. :)
STEP FOUR: CHANGE usernameTextBox TO YOUR TEXTBOX ID (for
example)
private function setBrowserFocus():void
ExternalInterface.call ("setBrowserFocus");
usernameTextBox.setFocus() ***CHANGE "usernameTextBox"***
STEP FOUR ENDS
The final step is to CHANGE the name to the name of
Application as shown below.
STEP FIVE: CHANGE "Main" TO THE NAME OF YOU APPLICATION
<actionScript:JavaScript>
<![CDATA[
function setBrowserFocus()
Main.focus(); ***CHANGE "Main" to the name of you
Application***
]]>
</actionScript:JavaScript>
STEP FIVE ENDS
Let me know how this works for you. Be sure to click the
"Mark as the answer!" link in my post if this is the correct
solution. Be sure to check out the author link to see why we have
to set the focus this way.
John

Similar Messages

  • Why iWork doesn't open an exel file 97'-2004 workbook? Icon shoes default during import.

    Why iWork doesn't open an exel file 97'-2004 workbook?
    A message appears that default during import. This document was created with a version of exel, which is not supported. Can be opened only documents created in exel'97 or greater.

    Hi DST
    This is a great effort and gesture. thank you on behalf of all the newbies.
    PJ

  • Disable AutoAnalyzer as default during setup.

    I was wondering if there is a way to have auto-analyzer disabled by default during the setup process, so that different user's won't have to disable it themselves?

    You mean as part of the installation process?
    That would be more of a programming question for a Adobe. This is just a user-to-user forum.

  • Is oracle user created by default during installation of OEL 5

    i want to know that is oracle user and its groups already created by default during installation of OEL 5.5 ??

    user13376823 wrote:
    i want to know that is oracle user and its groups already created by default during installation of OEL 5.5 ??Why would it? It's just an operating system. It doesn't know or care what applications you may or may not choose to install at any time in the future after it (the OS) is installed, nor does it know or care about the requirements of any application you may choose to install at any time in the future.

  • Imaq image control (Delete default Value)

    I have a problem with the vision imaq image control.
    I have defined for a "imaq image control" a default image for the development.
    Now the default image is no longer need and i want to remove the default value an reset the Control to an empty image.
    How can i reset the default Value from the "imaq image control" to an empty image?
    Solved!
    Go to Solution.
    Attachments:
    imaq_image.vi ‏2726 KB

    Cardinal1664 wrote:
    I have about 20 Vi's with imaq image controls with default images!
    I don't want to too that progmaticaly!?
    Another possible way is to automate this task, something like this:
    Just obtain list of VIs where Vision Control should be resetted to default, then run snippet above in the cycle.
    Andrey.
    Attachments:
    Empty Images.vi ‏17 KB

  • Reset numeric control to default

    Just wondering if you can reinitialise a numeric control to default value while a vi is running. I want to enter a batch number, when I press end batch button I want the batch number numeric control to return to either zero or blank.
    Thanks,
    David
    Solved!
    Go to Solution.

    Yes you can, see attached example.
    BR
    /Thomas
    Attachments:
    BatchTest.vi ‏11 KB

  • Programitically Reinitialize Specific Front Panel Controls To Default Values

    Hi everyone, I know I can re-initialize "all" controls to their default values using an Invoke Mode.  How do I re-initialize only specific controls I want to re-initialize to their default value?  Basically, I want to re-initialize all the controls except for one control.  I want to do this during run-time of the VI.
    Thanks so much! 

    In your situation, I would probably just reinitialize all and then immediately set the value of that one control.  Your alternative is to use the Reinitialize Value method for each and every control except that one.  You could do this in a FOR loop easily enough.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Setting control to default value when it is a strict type def

    If my subVI has a control that happens to be a strict type defined cluster and I have saved the values in the control as the default values, how can I change them back to the default values of the type def (which are empty).  Because it is a strict type definition, i cannot click on the elements inside the cluster and modify them (e.g. click on an array inside the cluster and do an empty array operation.)
    In the attached screenshot, the control "BLE Meters To Test" is just an array of clusters and I was able to empty the array.  The control "Capture Data" is a strict type def.  I would like to clear the contents of this control without having to delete the control and add it back with a new instance of the same strict type def.
    Solved!
    Go to Solution.
    Attachments:
    screenshot.PNG ‏33 KB

    are you talking about edit mode or run mode?
    You could temporarily add a second instance of the typedef (all empty), then change it to a constant. Whenver you need to reset at run time, write the new digram constant to a local variable of the control.
    glstill wrote:
    Because it is a strict type definition, i cannot click on the elements inside the cluster and modify them (e.g. click on an array inside the cluster and do an empty array operation.)
    Make sure to click on the array container, not on the array elements.
    LabVIEW Champion . Do more with less code and in less time .

  • Message output condition typ for PO not getting defaulted during PO create

    Hi,
    I have created a ZNEU output type for purchase order print out for ZNB purchase document type by copying the stndard NEU output  type ,
    I have mainatined the condition record in NACE for ZNEU out put type against the Purchase docuemnt type ZNB, but when i create a PO and save i am not getting the ZNEU message output type as default in PO,
    Kindy provide your valuable input.
    My requirement is to default z output type in PO

    Hi
    SPRO-MM-Purchasing-messages-ouput control-message type-define message type for PO-Fine tuned control PO
    Here you can define which message type needs to be defaulted
    Regards
    Sandeep

  • Controlling the default language for new business users

    Hi everyone,
    If this has been answered elsewhere, my apologies for asking again.
    My company is currently in the initial implementation of ByDesign (1405). I just migrated our employees into ByD using the migration tool. This went fine, and also created (inactive) Business Users for each employee.
    One small issue I have, is that for each Business User created, ByD picked a "Default Language" based on the country where the user's organization unit is based (so Dutch for users assigned to an entity in the Netherlands, Danish for users assigned to a unit in Denmark, etc...).
    This despite the fact that the only language we have configured in ByD during scoping is English. In fact, when you edit the default language on the business user record, the drop down only offers English as a choice.
    Since this is our test environment, this is not a big deal, but I would like to prevent this once I migrate user to our production environment.
    So: how do I make sure that the Default Language on each Business User created when creating an Employee is English? (I would rather not have to fix this manually for a large number of users).
    Thanks!
    Eelco

    It applies to selected text. It is part of the text's style.
    So if you want a document to be by default a particular language, make a template in which all the text and all the styles in the styles drawer are set to what you want.
    Peter

  • Control availability check during release of production order

    friends,
    Can you guys help me find the user exit/BADI which will allow me to control the release of production order after the availability check is complete.
    In detail, the scenario is that : based on a flag on material master, I should be able to ignore this product's availability during release. I cannot change the availability check to "KP" ( No check) as this product can be sold seperately. So what I thought was that if I get to control the availability check during production order release I would be able to ignore this product before check or may be after check and before the status change.
    I found PPCO0021 exit and function module EXIT_SAPLCOZR_003 which is actually intended for release control for automatic batch determination. I am not sure if I can use this.
    Please let me know if you guys have any idea.
    Thanks
    Prod_Planner

    Let me rephrase the scenario :
    I have a production order for a product P1 which consumes raw materials R1 and R2. R1 is supplied by a nearby vendor every 1 hour to my plant so I do not need to worry about the availability of it when releasing the order but R2 availability should be taken into consideration. So, function 1 or 2 in OPJK will not work (as release need to be stopped if R2 not available) hence I will be using 3. If I use 3, R1 availability is also considered hence the whole order is not released. I will maintain a flag on material master so if R1 has flag, I need to ignore R1's availability but still considering R2.
    As mentioned, I found PPCO---21 which could help me but need your help to understand if there is any other way.
    Thanks
    Prod_Planner

  • Is Table Control's default size is 13 always in all resolutions?

    Hi Experts,
    Pls. let me clarify that, " Is Table Control is always possess the DEFAULT # of records as 13? Is it SAP's  standard feature? or Is it purely depends on the machine (windows) resolution? Particularly, am interested in BDC scenarios?
    Is any body is hving the SAP Documentation, about the above specific issue?
    thanq.
    Message was edited by:
            Srikhar

    If you use below code for your VA42 ,then table controls number columns will not vary from pc to pc :
    data: f_option type ctu_params,
    f_option-updmode = 'S'.
    f_option-defsize = 'X'.
    f_option-dismode = 'N'.
    call transaction 'VA42' using bdcdata options from f_option messages into bdcerror.
    I know your requirement ,screen resolution will not solve your problem
    Check the below link :
    http://web.mit.edu/sapr3/dev/newdevstand.html
    http://web.mit.edu/ist/org/admincomputing/dev/abapstds/current/devstand8.html
    Thanks
    Seshu

  • SCCM Remote Control - Set default to not "scale to fit"

    We are using SCCM Remote Control Viewer (CmRcViewer.exe).
    By default the view is set to "scale to fit" (with a tick) for every computer you connect to. If you change it to unticked it then reverts back for the next computer you connect to. Is there a way to set the default not to be scale to fit (unticked)?
    I have looked through the registry but can't see anything obvious.
    Thanks!

    Sounds like a good DCR though which you can file on Connect (connect.microsoft.com) -- anything you file there goes directly into the product team's bug database. That doesn't mean it will get fixed, just that someone will review it and the more justification
    you can add, the more likely it will be considered to be addressed in the future.
    Jason | http://blog.configmgrftw.com

  • Grid Control and Default Date value

    I am facing 3 problems:
    1) One is I want to know how to create a grid control with combo
    box/drop down list control for certain fields within that grid.
    when I place the grid control no rows or columns can be seen
    everything is grey so how the heel should I know where to have
    the drop down list controls.these drop down list controls have
    some constant values bound to a difeerent stand alone table.
    2) In a grid control/in a single text box how can I set the
    default value to the today's date in the design environment.
    I tried setting the format of the date in the formatterinfo to
    MM/DD/yyyy but as soon as I try to click on the insert for the
    detail table in a Master-detail table relationship there is an
    error.
    3)I also wanted to know if anyone knows if there is a calendar
    control so that the user over the web can click on a particular
    date through the control so that formatting can be avoided.
    tHANKS
    null

    I am facing 3 problems:
    1) One is I want to know how to create a grid control with combo
    box/drop down list control for certain fields within that grid.
    when I place the grid control no rows or columns can be seen
    everything is grey so how the heel should I know where to have
    the drop down list controls.these drop down list controls have
    some constant values bound to a difeerent stand alone table.
    2) In a grid control/in a single text box how can I set the
    default value to the today's date in the design environment.
    I tried setting the format of the date in the formatterinfo to
    MM/DD/yyyy but as soon as I try to click on the insert for the
    detail table in a Master-detail table relationship there is an
    error.
    3)I also wanted to know if anyone knows if there is a calendar
    control so that the user over the web can click on a particular
    date through the control so that formatting can be avoided.
    tHANKS
    null

  • H:selectOneListbox control of defaults.

    It should be said up front, I am a newbie in JSF.
    I have two selectOneListBox on two different pages:
    <h:selectOneListbox id="pickSVP2" immediate="true" value="#{ConfigurationBean.currentSvp}" size="1">
         <a4j:support event="onchange" ajaxSingle="true" actionListener="#{ConfigurationBean.agentChanged}" reRender="pickSVP2,componentInfo" />
         <f:selectItems value="#{SVPBean.sig}" />
    </h:selectOneListbox>
    Both of them are the same except for the id's are different. On changes all is as expected the backing beans update. But when I change pages I get a different value or the previous value in the first control.
    I know I am using this control wrong, what I want is to force the second copy of the control to the value of the first on change.

    Thanks for the help Balu. The problem is all my option values and labels are strings only. They were binded to a string in the backend. Unless until I select an option, this error would shown. it mean that it is getting error when I dont select any of the option, which causing a NULL submit and converter exception. hmm. how do I make this select one has atleast one option selected everytime?
    This problem doesnt come with SelectManyListBox, since by default multiselect is having atleast one option select at loading time.

Maybe you are looking for