Showing results 1 to 3 of 3

Thread: Recipe combobox not refreshing after create

  1. #1
    Join Date
    19.09.2017
    Posts
    6

    Default Recipe combobox not refreshing after create

    Hi,

    I'm trying to modify an existing recipe name from code-behind and also create a new recipe. The changes seems to update after i switch back to the standard recipe page. But the recipe page does not update its content (like the combobox) while the user is inside the recipe page. He needs to switch off from the page and gets back into it to see the changes. I'm using the functions from the recipe object model and running with Zenon 6.51.

    So the question is, how can the recipe standard page be updated from code behind while staying on the recipe page? I would like to avoid using the RGM and stay using the standard recipe if possible.

    Am i doing something wrong?

    public void OnRecipeNameEdited(object obj, EventArgs arg)        {            
                try
                {
                    var recipeName = createEditRecipe.RecipeName;
                    recipe.Name = recipeName;
                    recipe.Save();
                }
                catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }
            }
    
            public void OnRecipeCreatedClicked(object obj, EventArgs arg) {
                try
                {
                    recipes = getRecipes();
    
                    var recipeName = createEditRecipe.RecipeName;
                    recipes.Create(recipeName);
                }
                catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }
            }

    Thank you in advance,

    Best regards,

    Mosa
    Last edited by MOSA_SENMATIC : 17th August 2018 at 09:00 Reason: Code not showing properly

  2. #2
    Join Date
    15.11.2016
    Posts
    95

    Default Re: Recipe combobox not refreshing after create

    Hello,

    I guess you would need to Update the screen via the Method "UpdateAll".
    See:
    http://onlinehelp.copadata.com/help/760/com/html/DynPicture-Methods-UpdateAll.htm

    There is a small example in this Post:
    https://forum.copadata.com/showthread.php?1113-How-to-Update-(Repaint-or-Refresh)-screen-after-color-change&p=3872#post3872

    Hope this helps.

    Georg

  3. #3
    Join Date
    19.09.2017
    Posts
    6

    Default Re: Recipe combobox not refreshing after create

    Hi, i tried that without any luck

    public void OnRecipeNameEdited(object obj, EventArgs arg)
            {            
                try
                {
                    var recipeName = createEditRecipe.RecipeName;
                    recipe.Name = recipeName;
                    recipe.Save();
                    getCurrentProject().DynPictures().Item("pic_RECIPE").UpdateAll();
                }
                catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }
            }
    
            public void OnRecipeCreatedClicked(object obj, EventArgs arg) {
                try
                {
                    recipes = getRecipes();
    
                    var recipeName = createEditRecipe.RecipeName;
                    recipes.Create(recipeName);
                    getCurrentProject().DynPictures().Item("pic_RECIPE").UpdateAll();
                }
                catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }
            }

Similar Threads

  1. Combobox
    By EdgyUsername in forum zenon Supervisor
    Replies: 3
    Last Post: 2nd February 2016, 08:22
  2. Replies: 0
    Last Post: 1st September 2015, 15:44
  3. Accessing the rgm recipe name combobox
    By andreacold in forum VBA
    Replies: 3
    Last Post: 24th February 2014, 14:35
  4. Replies: 1
    Last Post: 11th December 2013, 07:15
  5. refreshing the variable used
    By michael_k in forum VBA
    Replies: 3
    Last Post: 3rd January 2010, 23:17

Tags for this Thread

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •