loading image froma list box problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • grubdub
    Forum Member
    • Nov 2007
    • 3

    loading image froma list box problem

    hello..
    im using an example i found on here where i preload a listbox from a defined folder of jpg images.. when i select one of the list it should load a resized version on the page however it seems to be giving me an error no matter what i do .. please help?

    many thanks

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

    LB = "ListBox1";
    -- Get the selected items
    tSelected = ListBox.GetSelected(LB);

    -- Because we are not allowing multiple select in the
    -- ListBox object, we are only concerned with tSelected[1]

    if tSelected then


    -- If there is an item selected, get its data
    sFile = ListBox.GetItemData(LB, tSelected[1]);

    -- file attributes
    nSize = File.GetSize (sFile);
    tFileAtt = File.GetAttributes (sFile);
    sFileCreated = tFileAtt.CreationDate;
    sFileLastAccess = tFileAtt.AccessDate;
    sFileLastWritten = tFileAtt.WriteDate;
    -- get original image attributes
    tImage = Image.GetFileInfo(sFile);
    OriWidth = tImage.Width;
    OriHeight = tImage.Height;

    -- set information paragraph
    Paragraph.SetEnabled("Para_FileProps", true);
    sParaText = "File Path : "..sFile.."\r\nFile Size : "..nSize.." bytes | Created : "..sFileCreated
    sParaText = sParaText.."\r\nOriginal Image Size : Width = "..OriWidth.." pixels | Height = "..OriHeight.." pixels";
    sParaText = sParaText.."\r\nLast Access : "..sFileLastAccess.." | Last Written : "..sFileLastWritten;
    Paragraph.SetText("Para_FileProps", sParaText);
    Paragraph.SetEnabled("Paragraph2", true);

    -- set button properties
    Button.SetEnabled("Button_DeleteItem", true);
    Label.SetEnabled("Label_DeleteNote", true);


    -- set resize and image position. So change as you like
    -- set your size choice for the photo
    maxWidth = 375;
    maxHeight = 333;
    --x position from left of screen
    xPos = 15;
    --y position from left of screen
    yPos = 8;
    --View this function in the global area
    ResizeImage("Image3", sFile, maxWidth, maxHeight,xPos,yPos);

    else
    -- Display an error message
    Dialog.Message("Error", "There is no item selected.");
    end

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

    The error says : On select Line 47: Attempt to call global 'ResizeImage' (a Nil Value)
  • grubdub
    Forum Member
    • Nov 2007
    • 3

    #2
    yaaay i fixed it thanks anyway

    Comment

    Working...
    X