Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2005
    Posts
    17

    How to set the paragraph of a page from a button

    Hi,
    I have this issue I am trying to figure out.

    I have created a page, that serves as a template for all the other pages.
    In that page, called "Mal" I have placed a paragraph called currentpagetext.
    I use "Mal" as a page that all other pages inherit page properties and objects from.The plan is that it should show the current page the user is on.
    Like if you click on the News button, it should read News. If you click on the product button it should read Product.

    I try to use the following code in the button for News on the "Mal" page.
    Page.Jump("Nyheter");
    pic="AutoPlay\\Images\\blank.png";
    Image.Load("productImage",pic);
    Paragraph.SetText("currentpagetext","News");

    I have also tried with a global variable, but when I try to update the Paragraph.SetText, it comes back with an error message saying that I can only use text in this function.

    I made some functions in my global functions like this:

    function setcurrentpage(pagename)
    currentpage= pagename;
    end

    function getcurrentpage()
    return currentpage;
    end
    ----
    If I try to change my button code to:
    Page.Jump("Nyheter");
    pic="AutoPlay\\Images\\blank.png";
    Image.Load("productImage",pic);
    setcurrentpage("News");
    text=getcurrentpage();
    Paragraph.SetText("currentpagetext",text);

    then the error message appear.

    What am I doing wrong here?

  2. #2
    Join Date
    Dec 2005
    Posts
    17
    Anybody out there with a brilliant idea on how to fix this?
    Any help would be helpfull here.

  3. #3
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    how about a simple example project that duplicates the problem you are having (share such with us). It may draw some responses.

    Intrigued

  4. #4
    Join Date
    Dec 2005
    Posts
    17
    Here is an example of what I am trying to get to work.
    I have added one page "mal" where the objects are located.
    I have also added two pages, "news" and "products".
    I have two approaches to the problem, one with a global variable, and one with setting the values in the button.

    I can not figure this one out, and I intend to use it widely, to save coding.

    Please give me your insights on this problem. Thanks.
    Attached Files

  5. #5
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Global Functions (change to):

    Code:
    function set_currentpagetext(text)
    Page.Jump(text) -- Include double-quotes around what you type in!
    end
    
    function get_currentpagetext()
    return Application.GetCurrentPage();
    end
    On Show:

    Paragraph.SetText("currentpage", get_currentpagetext())
    Intrigued

  6. #6
    Join Date
    Dec 2005
    Posts
    17
    Is there no other way to do this?

    How can I create a global text value, and edit it from buttons?

    If I have a global variable called page,

    on any page I have a button I want to be able to change the global variable from the button.

    (I have approx. 150 products I need to get on this project, and I really do not want to create one page for every product. I want to create one page for all the products, and then use the global variable to find the correct product.

    This is why I wanted to write to a variable instead of getting data from Application.getcurrentpage(). Because that will not help me in the product issues.

    Is there a way to write to a global text variable, or do I need to store on HDD?

  7. #7
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    You should use a Table instead.
    Write your 150 elements in your table and just read from it at runtime, populating the paragraph object, title, etc...of this page of yours.

    Good luck
    Yossi

  8. #8
    Join Date
    Oct 2005
    Posts
    24
    if you create a textfile call "News" and one for "Products" on your HDD

    I think it would be possible to use the TextFile.ReadToString method and read it back from textfile "News" and "Products" into the paragraph.

  9. #9
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Quote Originally Posted by abcnormal
    Is there no other way to do this?

    How can I create a global text value, and edit it from buttons?

    If I have a global variable called page,

    on any page I have a button I want to be able to change the global variable from the button.

    (I have approx. 150 products I need to get on this project, and I really do not want to create one page for every product. I want to create one page for all the products, and then use the global variable to find the correct product.

    This is why I wanted to write to a variable instead of getting data from Application.getcurrentpage(). Because that will not help me in the product issues.

    Is there a way to write to a global text variable, or do I need to store on HDD?
    There is always another way.
    Intrigued

Similar Threads

  1. prob with togle background audio with button
    By Jonas DK in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 04-11-2005, 08:06 PM
  2. Example: Loading Paragraph Text Using a Timer
    By Jonas DK in forum AutoPlay Media Studio 5.0 Examples
    Replies: 7
    Last Post: 11-25-2004, 05:10 PM
  3. Example: Creating an on/off button to toggle background audio
    By Jonas DK in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 07-10-2004, 02:54 PM
  4. Button Hiding Blues
    By Tezcatlipoca in forum AutoPlay Media Studio 4.0
    Replies: 5
    Last Post: 04-11-2003, 04:57 PM
  5. HOWTO: Create a Page Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-26-2002, 05:20 AM

Posting Permissions

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