Announcement

Collapse
No announcement yet.

Application restart?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Application restart?

    I have set a background image in page properties, then this function to change it:

    Code:
    function backgrounds()
    -- Display a single-selection file browse dialog
    result = Dialog.FileBrowse(true, "Load Background File", _SourceFolder .. "\\AutoPlay\\Docs\\Backgrounds\\", "Png File (*.png)|*.png|All Files (*.*)|*.*|", "", "", false, true);
    result2 = String.Replace(result[1], [[\]], [[\\]], false);
    
    -- If CANCEL was not chosen, then let's get the file path
    if (result[1] ~= "CANCEL") then
        File.Copy(result2, _SourceFolder .. "\\AutoPlay\\Images\\Background.png", true, true, false, false, nil);
    end
    end
    For the new background image to take effect I need to restart the application, I have tried Page.Redraw () and Application.SetRedraw(true); but I still need to restart the application for the background to change, how can I do this in apms?

    Thanks.

  • #2
    You can use the Application.SetPageProperties.
    e.g.
    PHP Code:
    Application.SetPageProperties("Page1", {ImageFilename=_SourceFolder.."\\AutoPlay\\Images\\Background.png"}) 
    To learn more: http://www.indigorose.com/webhelp/am...Properties.htm.

    Comment


    • #3
      Originally posted by Ham View Post
      You can use the Application.SetPageProperties.
      e.g.
      PHP Code:
      Application.SetPageProperties("Page1", {ImageFilename=_SourceFolder.."\\AutoPlay\\Images\\Background.png"}) 
      To learn more: http://www.indigorose.com/webhelp/am...Properties.htm.
      Thanks very much, that's worked.

      I had to do this though because I have multiple pages:
      Code:
      function backgrounds()
      -- Display a single-selection file browse dialog
      result = Dialog.FileBrowse(true, "Load Background File", _SourceFolder .. "\\AutoPlay\\Docs\\Backgrounds\\", "Png File (*.png)|*.png|All Files (*.*)|*.*|", "", "", false, true);
      result2 = String.Replace(result[1], [[\]], [[\\]], false);
      
      -- If CANCEL was not chosen, then let's get the file path
      if (result[1] ~= "CANCEL") then
          File.Copy(result2, _SourceFolder .. "\\AutoPlay\\Images\\Background.png", true, true, false, false, nil);
          tbPageProperties = {};
          tbPageProperties.ImageFilename = result2
      	Application.SetPageProperties("Page1", tbPageProperties);
      	Application.SetPageProperties("Page2", tbPageProperties);
      	Application.SetPageProperties("Page3", tbPageProperties);  
      	Page.Redraw();
      end
      end
      Then at the top of each page propertied/on show (page 1)

      Code:
      Application.SetPageProperties("Page1", {ImageFilename=_SourceFolder.."\\AutoPlay\\Images\\Background.png"})
      Page.Redraw();
      Then at the top of each page propertied/on show (page 2)

      Code:
      Application.SetPageProperties("Page2", {ImageFilename=_SourceFolder.."\\AutoPlay\\Images\\Background.png"})
      Page.Redraw();

      Comment


      • #4
        I don't remember having to redraw each time I used to change background but why you reset the background each time you reset the page I not really understanding the point of changing a page can you send your APZ I sure something is a little wrong here.
        Plugins or Sources MokoX
        BunnyHop Here

        Comment


        • #5
          For some reason when I switched between pages, not all the pages would have the new background until the page was redrawn, it's not a big deal though as you don't notice it and it's very quick, and it's working fine so......

          Comment


          • #6
            Originally posted by mrdude View Post
            For some reason when I switched between pages, not all the pages would have the new background until the page was redrawn, it's not a big deal though as you don't notice it and it's very quick, and it's working fine so......
            AMS does have some strange quarkes at times lol
            Plugins or Sources MokoX
            BunnyHop Here

            Comment


            • #7
              You can also replace a background image with an Image Object.
              Just add an Image Object on your page and let it handle the background with Image.SetProperties("Image1", {ImageFile=_SourceFolder.."\\AutoPlay\\Images\\Bac kground.png"});

              Comment

              Working...
              X
              😀
              🥰
              🤢
              😎
              😡
              👍
              👎