Background Image?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • mustafa06
    Forum Member
    • Jul 2007
    • 287

    Background Image?

    How ı can change project background on preload event code ?

    ( For example : Inifile....... [Dat] Image = C:\1.bmp )

    how ı set it ?
  • ShadowUK
    No longer a forum member
    • Oct 2007
    • 1322

    #2
    Use a Page.SetProperties to change BackgroundImage to another string, Like doing

    Page.SetProperties("Page2", {BackgroundImage = INIFile.GetValue("C://Ini.ini", "Background", "ImagePage2")});

    not too sure, adapt that.

    Comment

    • Worm
      Indigo Rose Customer
      • Jul 2002
      • 3971

      #3
      or use an image as the bottom object, then use the normal AMS actions to load the image.

      Set its enabled property to false for best results.

      Comment

      • ShadowUK
        No longer a forum member
        • Oct 2007
        • 1322

        #4
        Originally posted by Worm View Post
        or use an image as the bottom object, then use the normal AMS actions to load the image.

        Set its enabled property to false for best results.
        I was thinking that as well.

        Comment

        • gbe
          Forum Member
          • Jul 2008
          • 15

          #5
          It's not working for me

          Hello,

          I tried to SetProperties but it's not working. My background is white. The code of my function is :

          --------------------------------------------------------------------------
          function ChangeBackground ()
          -- Get back the current page
          curpage = Application.GetCurrentPage();
          -- Get Back Background Info
          result = INIFile.GetValue (_SourceFolder .. "\\AutoPlay\\setup.ini", "Main", "Background");
          if result ~= "" then
          -- Create a table containing the properties to set for the page.
          tbPageProperties = {};
          tbPageProperties.BackgroundType = BG_IMAGE;
          tbPageProperties.ImageFilename = result;
          tbPageProperties.ImageStretchMode = BG_IMG_FITPAGE;
          -- Set the page's properties.
          Application.SetPageProperties(curpage, tbPageProperties);
          end
          end

          --------------------------------------------------------------------------

          This function is launch OnPreload of each pages.

          Do you know why it's not working? What is wrong in my script?

          Regards
          GBE

          Comment

          • TristanD
            Forum Member
            • Oct 2006
            • 314

            #6
            . .

            Comment

            • gbe
              Forum Member
              • Jul 2008
              • 15

              #7
              What do you mean by .. ?

              Comment

              • Ulrich
                Indigo Rose Staff Member
                • Apr 2005
                • 5130

                #8
                GBE, when something doesn't work as expected, the first thing I would do is try to include an error test after each function call, and see what it returns. Especially after Application.SetPageProperties(), in your case.
                Code:
                -- Test for error
                error = Application.GetLastError();
                if (error ~= 0) then
                    Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
                end
                Ulrich

                Comment

                • gbe
                  Forum Member
                  • Jul 2008
                  • 15

                  #9
                  I already made it but nothing appear. :-(

                  Comment

                  • RizlaUK
                    Indigo Rose Customer
                    • May 2006
                    • 5552

                    #10
                    dose your page already have a background image, if not you need to set the background type as well


                    Code:
                    function ChangeBackground ()
                    	-- Get back the current page
                    	curpage = Application.GetCurrentPage();
                    	-- Get Back Background Info
                    	result = INIFile.GetValue (_SourceFolder .. "\\AutoPlay\\setup.ini", "Main", "Background");
                    	if result ~= "" then
                    		-- Create a table containing the properties to set for the page.
                    		tbPageProperties = {};
                    		tbPageProperties.BackgroundType = BG_IMAGE;
                    		tbPageProperties.ImageFilename = result;
                    		tbPageProperties.ImageStretchMode = BG_IMG_FITPAGE;
                    		[COLOR="Red"]tbPageProperties.BackgroundType = BG_IMAGE;[/COLOR]
                    		-- Set the page's properties.
                    		Application.SetPageProperties(curpage, tbPageProperties);
                    	end
                    end

                    if that still dose not work, submit a support ticket as i seem to remember there being some problem with this function, but i can not remember the outcome
                    Embrace change in your life, you never know, it could all work out for the best

                    Comment

                    • gbe
                      Forum Member
                      • Jul 2008
                      • 15

                      #11
                      But in my code I already set the background type. Is the order important?

                      Regards
                      GBE

                      Comment

                      • Imagine Programming
                        Indigo Rose Customer
                        • Apr 2007
                        • 4252

                        #12
                        Originally posted by TristanD View Post
                        . .
                        I think it has something to do with ... but he has forgotton one...

                        thierry, what?:P
                        Bas Groothedde
                        Imagine Programming :: Blog

                        AMS8 Plugins
                        IMXLH Compiler

                        Comment

                        • RizlaUK
                          Indigo Rose Customer
                          • May 2006
                          • 5552

                          #13
                          But in my code I already set the background type. Is the order important?
                          i dont think so, but i do remember there being a issue, i'll run a quick test and see what i can do
                          Embrace change in your life, you never know, it could all work out for the best

                          Comment

                          • RizlaUK
                            Indigo Rose Customer
                            • May 2006
                            • 5552

                            #14
                            ok, there must be something else wrong, are you sure you got the right path to your ini file ??



                            check this example
                            Last edited by RizlaUK; 02-01-2009, 11:34 AM.
                            Embrace change in your life, you never know, it could all work out for the best

                            Comment

                            • gbe
                              Forum Member
                              • Jul 2008
                              • 15

                              #15
                              It's Crazy!! I tryied your project on my PC and it's not working.... I am lost...

                              Comment

                              Working...
                              X