Source language: Translate to:

RefreshObject: Synchronous ?

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

RefreshObject: Synchronous ?

Postby David de Argentina » Sat Apr 05, 2008 6:32 pm

Hi Dave,

I need do a iterate process each time I detect a change within Hans-Peter Grid.

At Grid definition I put this line:
SetVar "[Rectangulo1_SelAction]" "Gosub [#34]ver_foto[#34]"
and works fine.

Related function has the following lines

:ver_foto
1: hpwGridGetCell "Rectangulo1" "1" "[Rectangulo1_SelRow]" "[value]"
2: AE_SqLite_BLOB_Get "visitantes.sdb|control|imagen|id=[value]|[tempdir]imagen.jpg|ok"
3: delay "200"
4: RefreshObject "Imagen1"
return

Explanation:
Line 1: get the ID of the row
Line 2: extract an image from a Blob Field
Line 3: wait 200 milliseconds
Line 4: Refresh the object that retrieves the image (extracted on line 2 )

Aparently, everything is ok... and works.
But...
I think the RefreshObject "Imagen1" action is performed before the filewriting action.... because sometimes does not refresh the object
Is for this reason I put the Delay "200" action... in order to pause the refresh action...
How does RefreshObject action work really ?

Thanks in advance,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby Gaev » Sat Apr 05, 2008 7:55 pm

David de Argentina:

I am assuming that (Picture) object Imagen1 has file [tempdir]imagen.jpg associated with it ... perhaps you could try ...
Code: Select all
SetObjectFileName "Imagen1" ""
FileErase "[tempdir]imagen.jpg"
before the AE_SqLite_BLOB_Get command ... and after this command you can check if the file [tempdir]imagen.jpg exists ... (say) every 50 milliseconds ... and when it does exist ...
Code: Select all
SetObjectFileName "Imagen1" "[tempdir]imagen.jpg"
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby David de Argentina » Sun Apr 06, 2008 10:43 am

Thanks Gaev,

I tryed your suggestion, but the result is near the same...

I'm doing a sample in order to upload it and you can check them

Greetings from Buenos Aires,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby David de Argentina » Mon Apr 07, 2008 9:30 am

I think NeoBook is confused when the object filename is always the same.

I created this script and work fine:

Code: Select all
:ver_foto
hpwGridGetCell "Rectangulo1" "1" "[Rectangulo1_SelRow]" "[value]"
if "[value]" "<>" "[oldvalue]"
  setvar "[oldvalue]" "[value]"
  FileErase "[image]"
  Random "1000" "[p2]"
  setvar "[image]" "[tempdir]file[p2].jpg"
  AE_SqLite_BLOB_Get "visitantes.sdb|control|imagen|id=[value]|[image]|ok"
  RefreshObject "Imagen1"
endif
return

Where the ObjectFilename of "imagen1" is "[image]" (this is a Image Object)
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina


Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 2 guests