How i Do To Create More Images Gadget One Up of Each?

Just starting out? Need help? Post your questions and find answers here.
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

How i Do To Create More Images Gadget One Up of Each?

Post by Fasasoftware »

Dear friends.....

How i can create in a window more images gadgets one up on each other like a stack....in other words i want to make a composite of images and texts in the main window.....i have tryed everythings without success....i don't know where is my fault...i'm sorry...i know ...this is a very basic question...but also important for me.....
I would like to make a simple code as simple as possible...like spiderbasic do ......

ok....below i post my 2 wrong example...that don't work.......Can somebody help me please???? :oops:

Code: Select all

;
; ------------------------------------------------------------
;
;   My2 Image example file
;
;    FasaSoftware
;
; ------------------------------------------------------------
Global scriva
Global rettangolo


  
  ; Display the image in a new window
  If OpenWindow(#PB_Any, 320, 100, 640, 410, "Test2", #PB_Window_TitleBar)
    ImageGadget(scriva, 0, -2, ImageWidth(640), ImageHeight(410), ImageID(0))
   
  EndIf
  
LoadImage(scriva, "Data/desktop.png")
LoadImage(rettangolo, "Data/quadrato2.png")

My 1 example:

Code: Select all

;
; ------------------------------------------------------------
;
;   My Image example file
;
;   Fasasoftware
;This Software don't work!!!!
; ------------------------------------------------------------
Global scriva
Global rettangolo

Procedure Loaded(Type, Filename$, ObjectId)
  
  ; Display the image in a new window
  If OpenWindow(0, 320, 100, 640, 410, "Test", #PB_Window_TitleBar)
  ImageGadget(scriva, 0, -2, ImageWidth(640), ImageHeight(410), ImageID(0))
  ImageGadget(rettangolo, 300, 50, ImageWidth(50), ImageHeight(50), ImageID(0))
  EndIf
EndProcedure

Procedure LoadingError(Type, Filename$, ObjectId)
  Debug Filename$ + ": loading error"
EndProcedure

; Register the loading event before calling any resource load command
BindEvent(#PB_Event_Loading, @Loaded())
BindEvent(#PB_Event_LoadingError, @LoadingError())

LoadImage(scriva, "Data/desktop.png")
LoadImage(rettangolo, "Data/quadrato2.png")


I thank you a lot in advance...... :oops:

Best regards,

Lestroso
Fred
Site Admin
Posts: 1820
Joined: Mon Feb 24, 2014 10:51 am

Re: How i Do To Create More Images Gadget One Up of Each?

Post by Fred »

I don't think you can like that, may be you can tray to stack ContainerGadget() with one image in it but I'm no sure it will work either. Usually, you can not stack up the gadgets.
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Re: How i Do To Create More Images Gadget One Up of Each?

Post by Fasasoftware »

Hi fred,

Can you could give me some examples codes please??? Because so i will understand more better....

Thanks,

Lestroso
User avatar
Peter
Posts: 1197
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: How i Do To Create More Images Gadget One Up of Each?

Post by Peter »

this is a working example:

Code: Select all

EnableExplicit

Enumeration
  #Image1
  #Image2
  #ImageGaget1
  #ImageGaget2
EndEnumeration

Procedure Loaded(Type, Filename$, ObjectId)
  
  Select ObjectId
    Case #Image1
      SetGadgetState(#ImageGaget1, ImageID(#Image1))
    Case #Image2
      SetGadgetState(#ImageGaget2, ImageID(#Image2))
  EndSelect
  
EndProcedure

Procedure LoadingError(Type, Filename$, ObjectId)
  Debug Filename$ + ": loading error"
EndProcedure

If OpenWindow(0, 320, 100, 640, 410, "Test", #PB_Window_TitleBar)
  ImageGadget(#ImageGaget1,  10, 10, 0, 0, 0)
  ImageGadget(#ImageGaget2, 100, 10, 0, 0, 0)
EndIf

BindEvent(#PB_Event_Loading, @Loaded())
BindEvent(#PB_Event_LoadingError, @LoadingError())

LoadImage(#Image1, "Bullet_1.png")
LoadImage(#Image2, "Bullet_2.png")
(please remember to adjust your image-pathes)

Greetings ... Peter
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Re: How i Do To Create More Images Gadget One Up of Each?

Post by Fasasoftware »

Peter!!!!! I Thank You So Much!!!!! Thanks A MIllion!!! :D

Now I will try to understand this beatiful platform...Spider Basic!!!


Now i 'll try your code.....There's no word to thank you.....

Best regards,

Lestroso
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Re: How i Do To Create More Images Gadget One Up of Each?

Post by Fasasoftware »

Dear Peter...... I have tryed your code....and works very fine!!!!!

You have me Helped a lot......Thanks A lot Again..... ;)

Lestroso
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Re: How i Do To Create More Images Gadget One Up of Each?

Post by Fasasoftware »

Dear Peter...Dear friends....

I Have Another Problem........How I can HIde Some Gadget when i want??...I don't know where i must do the work flow of the program like the software below.....

I have tryed but this software works fine and show all my images very fine....but how i can change the state of the gadget when i want in other words... i how can make a flow for my program????? i have used hidegadget in a portion on caseselect....it works ... but i would like for examplemake a cicle for next and then appear a gadget .....and set the gadget to visible or hidden ....when i want......

Because it's little difficult for me work on procedure.....is there any other system without the procedure???


I have also tryed to cancel the procedure....but the images don't appear.....

Code: Select all

EnableExplicit

Enumeration
  #Image1
  #Image2
  #Image3
  #Image4
  #Image5
  #ImageGaget1
  #ImageGaget2
  #ImageGaget3
  #ImageGaget4
  #ImageGaget5
  
  
EndEnumeration

Procedure Loaded(Type, Filename$, ObjectId)
 
  Select ObjectId
    Case #Image1
      ;HideGadget(#ImageGaget1,1) <------if i use this instruction works.. but then i cant change after the state
      SetGadgetState(#ImageGaget1, ImageID(#Image1))
      Case #Image2
      SetGadgetState(#ImageGaget2, ImageID(#Image2))
      Case #Image3
        SetGadgetState(#ImageGaget3, ImageID(#Image3))
         Case #Image4
           SetGadgetState(#ImageGaget4, ImageID(#Image4))
           Case #Image5
      SetGadgetState(#ImageGaget5, ImageID(#Image5))
  EndSelect
  
 
EndProcedure

Procedure LoadingError(Type, Filename$, ObjectId)
  Debug Filename$ + ": loading error"
EndProcedure

 If OpenWindow(0, 320, 100, 640, 410, "Test", #PB_Window_TitleBar)
  
  ImageGadget(#ImageGaget1,  0, -2, 640, 410, 0)
  ImageGadget(#ImageGaget2, 300, 50, 50, 50, 0)
  ImageGadget(#ImageGaget3, 375, 70, 50, 50, 0)
  ImageGadget(#ImageGaget4, 375, 160, 50, 50, 0)
  ImageGadget(#ImageGaget5, 375, 160, 50, 50, 0)
  
  ;HideGadget(#ImageGaget1,0)   <------ i have tryed here but again don't works...the image don't appear

   
EndIf


BindEvent(#PB_Event_Loading, @Loaded())
BindEvent(#PB_Event_LoadingError, @LoadingError())

LoadImage(#Image1, "Data/desktop.png")
LoadImage(#Image2, "Data/quadrato2.png")
LoadImage(#Image3, "Data/up2.png")
LoadImage(#Image4, "Data/down2.png")
LoadImage(#Image5, "Data/wait.png")


Thanks a lot.... :oops:


Lestroso
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Re: How i Do To Create More Images Gadget One Up of Each?

Post by Fasasoftware »

Can Somebody Help Me Please???

I don't know how to solve this problem.......I'm Sorry....

Thanks A Lot....

Lestroso :oops:
User avatar
Peter
Posts: 1197
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: How i Do To Create More Images Gadget One Up of Each?

Post by Peter »

to be honest, i don't know what you want to do.

With HideGadget(#YourGadget, #True) you hide your Gadget

With HideGadget(#YourGadget, #False) you show your Gadget


Otherwise please try to explain again (with less punctuation marks ;-))

Greetings ... Peter
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Re: How i Do To Create More Images Gadget One Up of Each?

Post by Fasasoftware »

Dear Peter, Thanks a lot for your instructions, helped me a lot.

I'm sorry for punctuations, now i will never use it again.

Well, If I use the code HideGadget(#ImageGaget1,#True) , it works very fine, but in the manual there's not the value #True or #False, it there's only 1 or 0 that don't work fine.

I have made an example, that, i would like make appear the image "desktop.png" for a while and then disappear.

If i want make a cicle for next, don't work.Why? Where is my mistake?

Here below i have made an example code, that actualy don't work.

Last Question.

Where I must Put My Main Program In My Case? Ithink after the OpenWindow Command, after the gadgets.Is it right?


Code: Select all

; This example don't work fine
Global K

EnableExplicit

Enumeration
  #Image1
  #Image2
  #Image3
  #Image4
  #Image5
  #ImageGaget1
  #ImageGaget2
  #ImageGaget3
  #ImageGaget4
  #ImageGaget5
  
  
EndEnumeration

Procedure Loaded(Type, Filename$, ObjectId)
 
  Select ObjectId
    Case #Image1
      ;HideGadget(#ImageGaget1,1)
      SetGadgetState(#ImageGaget1, ImageID(#Image1))
      Case #Image2
      SetGadgetState(#ImageGaget2, ImageID(#Image2))
      Case #Image3
        SetGadgetState(#ImageGaget3, ImageID(#Image3))
         Case #Image4
           SetGadgetState(#ImageGaget4, ImageID(#Image4))
           Case #Image5
      SetGadgetState(#ImageGaget5, ImageID(#Image5))
  EndSelect
  
 
EndProcedure

Procedure LoadingError(Type, Filename$, ObjectId)
  Debug Filename$ + ": loading error"
EndProcedure

 If OpenWindow(0, 320, 100, 640, 410, "Test", #PB_Window_TitleBar)
  
  ImageGadget(#ImageGaget1,  0, -2, 640, 410, 0)
  ImageGadget(#ImageGaget2, 300, 50, 50, 50, 0)
  ImageGadget(#ImageGaget3, 375, 70, 50, 50, 0)
  ImageGadget(#ImageGaget4, 375, 160, 50, 50, 0)
  ImageGadget(#ImageGaget5, 375, 160, 50, 50, 0)
  ;----------------------------------I have tryed this code but don't work
  For k= 1 To 50 
  HideGadget(#ImageGaget1,#True)
  Next 
  If k = 50
    HideGadget(#ImageGaget1,#False)
   EndIf
;---------end of my code
  EndIf





BindEvent(#PB_Event_Loading, @Loaded())
BindEvent(#PB_Event_LoadingError, @LoadingError())

LoadImage(#Image1, "Data/desktop.png")
LoadImage(#Image2, "Data/quadrato2.png")
LoadImage(#Image3, "Data/up2.png")
LoadImage(#Image4, "Data/down2.png")
LoadImage(#Image5, "Data/wait.png")




I thank you a lot Peter

Best regards

Lestroso
Post Reply