SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Sep 2009
    Location
    Littleton, Mass
    Posts
    57
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    userform is undefined when jumping functions

    I totally forgot how I did this.
    I have a unit with the following code.

    function main()
    {
    var frm = UserForms.BasicSetup
    frm.ShowModal();
    //This are set via that form windown
    }

    /* ******************************************** */
    function BasicSetup_cxSave_OnClick(Sender)
    /* ******************************************** */
    {
    Project.Variables.browser=frm.cxTextBrowser.text;
    }

    I run "main" and the form appears.
    I click a button that calls OnClick and get
    "frm is undefined".
    I see that it lost focus cause it's in another function
    and I totally can't find (45 min with help) how I allowed
    the form to be accessed from other functions.

    I can't even figure it out from my other project that is working ok. All I see is that frm is a global variable but that doesn't make sense since it's never set.

    Yipes.
    Thanks
    Steph
    Stephanie Beach
    QA Manager
    Certica Solutions
    Wakefield, Ma

  2. #2
    Member
    Join Date
    Jan 2010
    Posts
    94
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: userform is undefined when jumping functions

    Hi,

    The frm variable is not global in your example, its local variable for main() function, since it declared there via "var" statement.

    You should declare it outside the function to make it global and accessible in all functions of the script unit:

    var frm;
    function main()
    {
    frm = UserForms.BasicSetup;
    frm.ShowModal();
    }
    /* ******************************************** */
    function BasicSetup_cxSave_OnClick(Sender)
    /* ******************************************** */
    {
    Project.Variables.browser=frm.cxTextBrowser.text;
    }

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:47 PM.

Copyright BetaSoft Inc.