realbasic-nug.it
[Top] [All Lists]

Re: per favore...

To: REALbasic NUG Italian <realbasic-nug dot it at lists dot realsoftware dot com>
Subject: Re: per favore...
From: Massimo Valle <maxduepuntozero at yahoo dot it>
Date: Sat, 20 Jan 2007 16:47:22 +0100
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug dot it at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.it; h=Received:X-YMail-OSG:Mime-Version:In-Reply-To:References:Content-Type:Message-Id:Content-Transfer-Encoding:From:Subject:Date:To:X-Mailer; b=a8uK5/bjLYpy2oj3+FlvYljhQkNabILAqDQUysZCG3RYlllf/ibaSmMw8M4K2QhbbNZO/DrxMdxKYgEuRWx4l280P6WTdjedivQdUEiqkj6vTztHhYHZpvmfHgOEMEW8hZy8T/U8W3riZIz6RpWEeV7Zjjjl84xm5NB0qsf+pCg= ;
References: <p05200f01c1d54eb73b88 at [192 dot 168 dot 0 dot 2]> <A7F4082B-0318-4B72-92BD-FEC41E641486 at yahoo dot it> <p05200f00c1d7d8426454 at [192 dot 168 dot 0 dot 2]>

On 20/gen/07, at 15:33, baccheschi at tin dot it wrote:

Massimo
i nomi corrispondenti alle immagini    ( .... pippo.jpg.....
dinosauro.jpg....) sono stati letti da un file "elenco.txt"
mario

ok allora fai così:

nel text file che usi per leggere i nomi, memorizza invece il path dei files immagine.
Quando carichi la listbox, leggi i path e tenti di risolverli:

// supponendo che Listbox1 sia la tua listbox

dim elenco as folderitem
dim elencoStream as textInputStream
dim f as folderitem
dim p as picture

elenco = getFolderItem("elenco.txt")
if elenco <> nil and elenco.exists and elenco.isReadable then
  elencoStream = elenco.openAsTextFile
  if elencoStream <> nil then
    while not elencoStream.EOF
      f = getFolderItem(elencoStream.readLine)
      if f <> nil and f.exists and f.isReadable and then
        p = f.openAsPicture
        if p <> nil then
          Listbox1.addrow f.name
Listbox1.cellTag(Listbox1.lastIndex, 0) = getFolderItem (f.absolutePath)
        end if
      end if
    wend
  end if
end if

quanto sopra ti aggiunge i nomi dei files nella listbox e memorizza il path delle immagini

Nell'evento Change di Listbox1 inserisci:

if me.listIndex <> -1 then
Canvas1.backdrop = folderItem(me.cellTag(me.listIndex, 0)).openAsPicture
else
  Canvas1.backdrop = nil
end if

Questo è un metodo semplice per farlo.
Naturalmente poi devi considerare la grandezza dell'immagine ed eventualmente scalarla (se serve) alla dimensione del Canvas, quindi puoi modificare la procedura. Potresti ad esempio fare una subclass di Canvas con un metodo che accetta come parametro un picture e chiamare quello invece di impostare il backdrop.

Ciao

Massimo

P.S: non l'ho provata, ho scritto direttamente il messaggio e quindi potrebbe esserci qualche errore.Chiacchiera con i tuoi amici in tempo reale!
http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com


From  Sun 21 Jan 2007 15:05:59 +0100
Return-Path: <realbasic-nug dot it-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
        id 8AF7217944BB; Sun, 21 Jan 2007 06:06:24 -0800 (PST)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on
        www.realsoftware.com
X-Spam-Level:
X-Spam-Status: No, score=-1.6 required=4.5 testsºYES_00,NO_REAL_NAME
        autolearn=no version=3.1.1
Received: from lists.realsoftware.com (lists.realsoftware.com [209.198.132.125])
        by xmail.realsoftware.com (Postfix) with ESMTP id 42FD017944B4;
        Sun, 21 Jan 2007 06:06:20 -0800 (PST)
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id C4C5F183DC3D; Sun, 21 Jan 2007 08:06:18 -0600 (CST)
X-Original-To: realbasic-nug dot it at lists dot realsoftware dot com
Delivered-To: realbasic-nug dot it at lists dot realsoftware dot com
Received: from vsmtp3.tin.it (vsmtp3.tin.it [212.216.176.223])
        by lists.realsoftware.com (Postfix) with ESMTP id AE2A6183DC31
        for <realbasic-nug dot it at lists dot realsoftware dot com>;
        Sun, 21 Jan 2007 08:06:11 -0600 (CST)
Received: from [192.168.0.2] (87.11.129.253) by vsmtp3.tin.it (7.2.072.1)
        id 4589478000C61DE1 for realbasic-nug dot it at lists dot realsoftware 
dot com;
        Sun, 21 Jan 2007 15:06:10 +0100
Mime-Version: 1.0
X-Sender: baccheschi at box dot tin dot it
Message-Id: <p05200f00c1d923a1adce at [192 dot 168 dot 0 dot 2]>
In-Reply-To: <52F3B9BA-BEEB-4130-995C-8077B97BD770 at yahoo dot it>
References: <p05200f01c1d54eb73b88 at [192 dot 168 dot 0 dot 2]>
        <A7F4082B-0318-4B72-92BD-FEC41E641486 at yahoo dot it>
        <p05200f00c1d7d8426454 at [192 dot 168 dot 0 dot 2]>
        <52F3B9BA-BEEB-4130-995C-8077B97BD770 at yahoo dot it>
Date: Sun, 21 Jan 2007 15:05:59 +0100
To: REALbasic NUG Italian <realbasic-nug dot it at lists dot realsoftware dot 
com>
From: baccheschi at tin dot it
Content-Type: text/plain; charset="iso-8859-1" ; format="flowed"
Content-Transfer-Encoding: quoted-printable
Subject: Re: per favore...
X-BeenThere: realbasic-nug dot it at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG Italian <realbasic-nug dot it at lists dot realsoftware 
dot com>
Sender: realbasic-nug dot it-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug dot it-bounces at lists dot realsoftware dot com

On 20/gen/07, at 15:33, baccheschi at tin dot it wrote:

Massimo
i nomi corrispondenti alle immagini    ( .... pippo.jpg.....
dinosauro.jpg....) sono stati letti da un file "elenco.txt"
mario

ok allora fai così:

nel text file che usi per leggere i nomi, memorizza invece il path
dei files immagine.
Quando carichi la listbox, leggi i path e tenti di risolverli:

// supponendo che Listbox1 sia la tua listbox

dim elenco as folderitem
dim elencoStream as textInputStream
dim f as folderitem
dim p as picture

elenco = getFolderItem("elenco.txt")
if elenco <> nil and elenco.exists and elenco.isReadable then
  elencoStream = elenco.openAsTextFile
  if elencoStream <> nil then
    while not elencoStream.EOF
      f = getFolderItem(elencoStream.readLine)
      if f <> nil and f.exists and f.isReadable and then
        p = f.openAsPicture
        if p <> nil then
          Listbox1.addrow f.name
          Listbox1.cellTag(Listbox1.lastIndex, 0) =
getFolderItem(f.absolutePath)
        end if
      end if
    wend
  end if
end if

quanto sopra ti aggiunge i nomi dei files nella listbox e memorizza
il path delle immagini

Nell'evento Change di Listbox1 inserisci:

if me.listIndex <> -1 then
  Canvas1.backdrop = folderItem(me.cellTag(me.listIndex, 0)).openAsPicture
else
  Canvas1.backdrop = nil
end if

Questo è un metodo semplice per farlo.
Naturalmente poi devi considerare la grandezza dell'immagine ed
eventualmente scalarla (se serve) alla dimensione del Canvas, quindi
puoi modificare la procedura. Potresti ad esempio fare una subclass
di Canvas con un metodo che accetta come parametro un picture e
chiamare quello invece di impostare il backdrop.

Ciao

Massimo

P.S: non l'ho provata, ho scritto direttamente il messaggio e quindi
potrebbe esserci qualche errore.Chiacchiera con i tuoi amici in
tempo reale!
http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com

Grazie Massimo
provo subito
Mario


<Prev in Thread] Current Thread [Next in Thread>
  • Re: per favore..., Massimo Valle
    • Message not available
      • Re: per favore..., Massimo Valle <=