RefreshObject: Synchronous ?

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

Moderator: Neosoft Support

Locked
David de Argentina
Posts: 1596
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina
Contact:

RefreshObject: Synchronous ?

Post by David de Argentina »

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
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Post by Gaev »

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"
David de Argentina
Posts: 1596
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina
Contact:

Post by David de Argentina »

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
David de Argentina
Posts: 1596
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina
Contact:

Post by David de Argentina »

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)
Locked