element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Autodesk EAGLE
  • Products
  • More
Autodesk EAGLE
EAGLE User Support (English) ULP: How to update the status of a variable changed by checkbox inside exisiting and open dialog
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Autodesk EAGLE to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 3 replies
  • Answers 1 answer
  • Subscribers 179 subscribers
  • Views 691 views
  • Users 0 members are here
  • ulp
Related

ULP: How to update the status of a variable changed by checkbox inside exisiting and open dialog

zainka
zainka over 11 years ago

Hi

 

I am curently writing an ulp where I have a dialog with a tabwidget and a few tabs. In one tab I have a radiobutton dialogs which will alter an variable. Before running dlgAccept and thus storing the new status of the variables etc and closing the dialog, is it possible to have the actual variable updated with the status of the selected radiobutton while the dialog is still open? Thus if I switch tab i will be able to use the variable with value as given by the radiobutton state?

 

I have attached a demo.ulp showing the problem. I though that dlgRedisplay() should have fixed it, but either I did not use it correctly or I have misunderstood the purpose of it. When I used dlgRedisplay the dialog closed and execution continued. NOTE: In the demo.ulp I have removed the redisplay function. It only have a textual description of what I want to achieve. (EDIT: erh.. forget the dlgAccept in line 35, It was some silly test to se if it had any effect, but off-course not, so forget it)

I fear that the dlgRedisplay may only work on strings that changes, ref. the example in the manual with dlgLabel

 

By the way. Here is the code I had when using dlgRedisplay(), i called it after hitting an radiobutton.

 

dlgRadioButton("&POST", HttpMethod) dlgRedisplay();

dlgRadioButton("&GET", HttpMethod) dlgRedisplay();

 

 

Message was edited by: vidar vidnes

Attachments:
demo.ulp.zip
  • Sign in to reply
  • Cancel
Parents
  • autodeskguest
    0 autodeskguest over 11 years ago

    On 6/11/2014 7:34 p.m., vidar vidnes wrote:

    Hi

     

    I am curently writing an ulp where I have a dialog with a tabwidget and

    a few tabs. In one tab I have a checkbox dialog which will alter an

    variable. Before running dlgAccept and thus storing the new status of

    the variables etc and closing the dialog, is it possible to have the

    actual variable updated with the status of the checkbox while the dialog

    is still open? Thus if I switch tab i will be able to use the variable

    with value as given by the checkbox state?

     

     

    Sure, you don't use dlgAccept() until you really want to close the

    dialog and you don't need it to update variables as they update when you

    leave the statement of the various dlg functions. There is the rare

    occasion when you need the dlgRedisplay

     

    try this

     

     

    string CheckResult = "off";

    int checked;

    dlgDialog(""){

       dlgTabWidget {

         dlgTabPage("Tab &1") {

          dlgLabel(CheckResult,1);

          dlgIntEdit(checked, 0, 1);

         }

         dlgTabPage("Tab &2") {

           dlgCheckBox("The Check Box",checked){

         if(checked) CheckResult = "on";

         else {

           CheckResult = "off";

         }

           }

           dlgIntEdit(checked, 0, 1);

         }

       }

    };

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • zainka
    0 zainka over 11 years ago in reply to autodeskguest

    Hi

     

    I know that the dlgLabel may be updated instantly, but the problem is that it is only valid for strings, The challenge are to deal with the fact that the tabs are built when the dialog starts and not when a tab is activated. Now I do not think there is a solution for my problem and thus I need to find another way to do what I want. My ideal world would be  that the entire tab , i.e. dlgTabPage(), could be rebuilt when accessed, maybe not as default but with a future reload option as dlgLabel already have by setting an aditional Update flag. Code below will show my problem. The dlgLabel("string", 1) is actively updated but the other code runs only once when dialog is called.

     

    If the changes I needed to be reflected in the new tab was dlgLabel based only it would have solved my problem, but as long as I also actually wanted to change the very layout of the tab the solution given wont help.

     

     

    ********************************************

    int POST = 0;

    int GET = 1;

     

    string CheckResult = "POST";

    int checked = POST;

     

    dlgDialog("")

    {

      dlgTabWidget

      {

        dlgTabPage("Tab1")

        {

          dlgGroup("Methode")

          {

            dlgRadioButton("POST",checked) CheckResult = "POST";

            dlgRadioButton("GET",checked) CheckResult = "GET";

          }

        }

     

        dlgTabPage("Tab2")

        {

          dlgLabel(CheckResult, 1);

     

          if (CheckResult == "POST")

            dlgLabel("POST related settup");

          else

            dlgLabel("GET related settup");

        }

     

      }

    };

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • zainka
    0 zainka over 11 years ago in reply to autodeskguest

    Hi

     

    I know that the dlgLabel may be updated instantly, but the problem is that it is only valid for strings, The challenge are to deal with the fact that the tabs are built when the dialog starts and not when a tab is activated. Now I do not think there is a solution for my problem and thus I need to find another way to do what I want. My ideal world would be  that the entire tab , i.e. dlgTabPage(), could be rebuilt when accessed, maybe not as default but with a future reload option as dlgLabel already have by setting an aditional Update flag. Code below will show my problem. The dlgLabel("string", 1) is actively updated but the other code runs only once when dialog is called.

     

    If the changes I needed to be reflected in the new tab was dlgLabel based only it would have solved my problem, but as long as I also actually wanted to change the very layout of the tab the solution given wont help.

     

     

    ********************************************

    int POST = 0;

    int GET = 1;

     

    string CheckResult = "POST";

    int checked = POST;

     

    dlgDialog("")

    {

      dlgTabWidget

      {

        dlgTabPage("Tab1")

        {

          dlgGroup("Methode")

          {

            dlgRadioButton("POST",checked) CheckResult = "POST";

            dlgRadioButton("GET",checked) CheckResult = "GET";

          }

        }

     

        dlgTabPage("Tab2")

        {

          dlgLabel(CheckResult, 1);

     

          if (CheckResult == "POST")

            dlgLabel("POST related settup");

          else

            dlgLabel("GET related settup");

        }

     

      }

    };

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • autodeskguest
    0 autodeskguest over 11 years ago in reply to zainka

    On 7/11/2014 6:26 a.m., vidar vidnes wrote:

    Hi

     

    I know that the dlgLabel may be updated instantly, but the problem is

    that it is only valid for strings, The problem is that the tabs are

    built when the dialog starts and not when tab is activated. I do not

    think there is a solution for my problem and thus I need to find another

    way to do what I want. My ideal world would be  that the entire tab ,

    i.e. dlgTabPage(), could be rebuilt when accessed, maybe not as default

    but with a future reload option as dlgLabel already have by setting an

    aditional Update flag. Code below will show my problem. The

    dlgLabel("strin", 1) is actively updated while the other code runs only

    once when dialog is called.

     

     

     

    You missed my point.

    In my ulp the value of a int variable (checked) is changed by the Check

    box and immediately the following statement is run to change the string

    variable (CheckResult).

     

    The change to 'checked' is immediately reflected in the dlgIntEdit

    fields and subsequently the change to 'CheckResult' string is reflected

    in the label.

     

    This demonstrates that you can make changes to the variables that drive

    the controls.

     

    From your code I see you may be trying to change the layout of the

    dlgDialog after it has been created, that you cannot do directly. For

    example, you may wish to have a button on a tab page but only if a

    condition is met. You're on the right track if you put your dlgDialg()

    into a function and leave and re-enter it to re-build the dialog.

    See attached where the dlgDialog is within a while loop.

    HTH

    Warren

     

     

    Attachments:
    TabCheckBoxButton.ulp.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube