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
Randomise picture load into picture gadget?
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
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):
PB - Registered PureBasic Coder
Edited by - PB on 05 December 2001 13:19:52
If all your pictures are numbered, you could use the Rnd command to selectI 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.
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
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
I haven't actually used images in PureBasic yet, so I don't really know whatThe 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.
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
[/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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Fangbeast.
:)
Fangles
I think I'm going to start putting, "Beware the Registered Fangs of PureBasic"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

Fangles