Page 1 of 1
Posted: Wed Dec 05, 2001 12:18 pm
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
I want to randomise the picture loaded into a picture gadget each time I start the program. Any way this can be done? I've tried things for a few hours but not getting anywhere.
Regards, Fang
Fangles
Posted: Wed Dec 05, 2001 1:12 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
I want to randomise the picture loaded into a picture gadget each time I start the program. Any way this can be done? I've tried things for a few hours but not getting anywhere.
If all your pictures are numbered, you could use the Rnd command to select
one for loading. If they're not numbered, and just random files, just select
a random number and then read all the files in the dir, one by one, and use
the pic that matches the random number chosen at the start of the dir walk.
For example (pseudo-code):
Code: Select all
; Assume 10 pictures in c:\pics\
num=random number from 1 to 10
start reading c:\pics\
counter=counter+1
getNextPictureInFolder
if counter=num
useThisPic
endif
stop reading c:\pics\
PB - Registered PureBasic Coder
Edited by - PB on 05 December 2001 13:19:52
Posted: Wed Dec 05, 2001 11:02 pm
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
What I did initially was load the list of files into a list and read to a filename after I generated a random number. But that wasn't the problem.
The picture item is always initialised after the number of gadgets have been declared and there seems to be no way of "plugging in" a new picture there each time I start the program.
When I try to make the image gadget item a variable gadget, even the gadget windows are no longer drawn.
Oh well, I'll try a few more things
Fangles
Posted: Wed Dec 05, 2001 11:06 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
The picture item is always initialised after the number of gadgets have been declared and there seems to be no way of "plugging in" a new picture there each time I start the program.
I haven't actually used images in PureBasic yet, so I don't really know what
you mean. But if you like, post a code snippet that I can use in PureBasic
to see what you mean...
PB - Registered PureBasic Coder
Edited by - PB on 05 December 2001 23:07:28
Posted: Thu Dec 06, 2001 8:07 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
[/quote]
I haven't actually used images in PureBasic yet, so I don't really know what
you mean. But if you like, post a code snippet that I can use in PureBasic
to see what you mean...
[/quote]
It's okay, I figured out what I was doing wrong. Just waiting for a compiler fix to happen shortly and then I can implement the rest of my ideas. Anyone is welcome to my source but it won't make much sense if you aren't doing it for IncrediMail addicts.
Why do you always put in "registered PureBasic user" ??? We all know who we are

:):)
Fangles
Posted: Thu Dec 06, 2001 11:15 am
by BackupUser
Restored from previous forum. Originally posted by PB.
Why do you always put in "registered PureBasic user" ??? We all know who we are

:):)
I got the idea from wavemaker.
PB - Registered PureBasic Coder
Posted: Thu Dec 06, 2001 3:42 pm
by BackupUser
Restored from previous forum. Originally posted by wavemaker.
Well, actually, Wavemaker is my brother, but I use his login since he has dropped interest in PureBasic (has no time for it). And I don't dare changing his signature without permission XD
Bye,
Juan Calderón Alonso
Registered user
Posted: Fri Dec 07, 2001 4:19 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
Well, actually, Wavemaker is my brother, but I use his login since he has dropped interest in PureBasic (has no time for it). And I don't dare changing his signature without permission XD
I think I'm going to start putting, "Beware the Registered Fangs of PureBasic"

:)
Fangles