[Solved]2nd drawn image not showing

Just starting out? Need help? Post your questions and find answers here.
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

[Solved]2nd drawn image not showing

Post by Distorted Pixel »

Hi, I have been working on this screen for a few days and I can 't figure out how to get the 2nd drawn image to show. I see it flashes once like it was there and then disappears. I'm assuming something covers it up, so I put it as the last thing to be placed on screen, but it still disappears. I have tried making the background transparent near the beginning after the first drawn image and transparent after everthing else, but it doesn't work.

All the 2nd image is is some text drawn out. It is suppose to show under the stats area.
https://mega.nz/file/EwNG1a5C#3tsQiAS34 ... xZ0WQODYPw

Code: Select all

Enumeration
  #ImgGadget  
  #IconGadget
  #EditGadget
  #GadgetItem
  #TxtGadget
EndEnumeration

Global NPC_Name.s = "Tony Pennock"
Global KP, TK, PS, SH, PC, HE, ST, SP, BC, FT
Global Plyr_Wage

Global Plyr_Val$, Contract_Exp$, Status$, League_Pay_Bonus, Promotion_Bonus, Cup_Win_Bonus, Cup_RU_Bonus, Win_Bonus, Goal_Bonus
Global Plyr_Age, Plyr_DOB$, Nationality$, Plyr_Moral$, Future$ : Global Plyr_Description.s

Plyr_Val$ = "10K" : Plyr_Wage = 230 : Contract_Exp$ = "23rd Jun '01" : Status$ = "Under Contract"
KP = 50 : TK = 25 : PS = 23 : SH = 11 : PC = 71 : HE = 23 : ST = 66 : SP = 31 : BC =26 : FT = 100
League_Pay_Bonus = 460 : Promotion_Bonus = 230 : Cup_Win_Bonus = 230 : Cup_RU_Bonus  = 110
Win_Bonus        = 23  : Goal_Bonus      = 23  : Plyr_Age      = 27  : Plyr_DOB$     = "10th April 1971"
Nationality$     = "Welsh"
Plyr_Moral$      = "Pleased"
Future$          = "Not worried"
Plyr_Description = "A safe goalkeeper. He's good on fits and spurts"

; player stat sheet include
Procedure PlayerStatsSheet()
  OpenWindow(0, 0, 0, 1024, 768, "Ultimate Football Manager", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | 
                                                              #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
  InitSprite()
  
    ImgFile = LoadImage(0, "Images/PlayerStatsSheet.png")
      ImageGadget(#ImgGadget, 0, 0, 1024, 768, ImgFile)
      DisableGadget(#ImgGadget, #True)
     
    LoadFont(0, "Media/nevis.ttf", 25);, #PB_Font_Bold)
    
    If StartDrawing(ImageOutput(#ImgGadget))
      DrawingFont(FontID(0))
      DrawText(5, 5, NPC_Name, $0025B8, $000000)
      StopDrawing()
    EndIf
   
      ImageGadget(#ImgGadget, 0, 0, WindowWidth(0), WindowHeight(0), ImageID(0))
      DisableGadget(#ImgGadget, #True)

      LoadFont(0, "Media/nevis.ttf", 15)
  
    If StartDrawing(ImageOutput(#ImgGadget))
      DrawingFont(FontID(0))
      DrawText(5, 900, Plyr_Description, $0025B8, $000000)
      StopDrawing()
    EndIf
  
    ImageGadget(#ImgGadget, 0, 0, WindowWidth(0), WindowHeight(0), ImageID(0))
    DisableGadget(#ImgGadget, #True)
         
      LoadFont(0, "Media/nevis.ttf", 11, #PB_Font_Bold)
      
  ListIconGadget(#IconGadget, 5, 65, 560, 500,"", 125, #LVS_NOCOLUMNHEADER); | #PB_ListIcon_GridLines)
  AddGadgetColumn(#IconGadget, 1, "", 100) ; column 1
  AddGadgetColumn(#IconGadget, 2, "", 125) ; column 2
  AddGadgetColumn(#IconGadget, 3, "", 125) ; column 3
  SetGadgetColor(#IconGadget, #PB_Gadget_LineColor, $259F4B)  
  SetGadgetFont(#IconGadget, FontID(0))
  SetGadgetColor(#IconGadget, #PB_Gadget_BackColor, $000000) : SetGadgetColor(#IconGadget, #PB_Gadget_FrontColor, $0025B8)
  
  ; column 1
  AddGadgetItem(#IconGadget, 0, "Goalkeeper")
  AddGadgetItem(#IconGadget, 1, "")
                                ; column 1                           column 2
  AddGadgetItem(#IconGadget, 2, "Keeping" + Chr(10) + KP + Chr(10) + "Heading" + Chr(10) + HE)
  SetGadgetItemColor(#IconGadget, 2, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 3, "Tackling" + Chr(10) + TK + Chr(10) + "Stamina" + Chr(10) + ST)
  SetGadgetItemColor(#IconGadget, 3, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 4, "Passing" + Chr(10) + PS + Chr(10) + "Set Plays" + Chr(10) + SP)
  SetGadgetItemColor(#IconGadget, 4, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 5, "Shooting" + Chr(10) + SH + Chr(10) + "Ball Control" + Chr(10) + BC)
  SetGadgetItemColor(#IconGadget, 5, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 6, "Pace" + Chr(10) + PC +Chr(10) + "Fitness" + Chr(10) + FT)
  SetGadgetItemColor(#IconGadget, 6, #PB_Gadget_FrontColor, $00A1B8)
  
  For item = 0 To CountGadgetItems(#IconGadget)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  Next
  
  AddGadgetItem(#IconGadget, 7, "")
  AddGadgetItem(#IconGadget, 8, "Contract Details")
  SetGadgetItemColor(#IconGadget, 8, #PB_Gadget_FrontColor, $0025B8)
  
  AddGadgetItem(#IconGadget, 9, "Value" + Chr(10) + Plyr_Val$ + Chr(10) + "Wages" + Chr(10) + Plyr_Wage)
  SetGadgetItemColor(#IconGadget, 9, #PB_Gadget_FrontColor, $00A1B8)
  
  For item = 0 To CountGadgetItems(#IconGadget)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  Next
  
  AddGadgetItem(#IconGadget, 10, "Contract Expiry" + Chr(10) + Chr(10) + Contract_Exp$)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $00A1B8)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $FFFFFF, 2)
  
  AddGadgetItem(#IconGadget, 11, "Status" + Chr(10) + Chr(10) + Status$)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $C3C3C3, 2)
  
  AddGadgetItem(#IconGadget, 12, "")
  AddGadgetItem(#IconGadget, 13, "Bonuses")
  
  AddGadgetItem(#IconGadget, 14, "League" + Chr(10) + League_Pay_Bonus + Chr(10) + "Promotion" + Chr(10) + Promotion_Bonus)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 15, "Cup Win" + Chr(10) + Cup_Win_Bonus + Chr(10) + "Cup R.U." + Chr(10) + Cup_RU_Bonus)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 16, "Win" + Chr(10) + Win_Bonus + Chr(10) + "Goal." + Chr(10) + Goal_Bonus)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 17, "")
  
  AddGadgetItem(#IconGadget, 18, "Age" + Chr(10) + Plyr_Age + Chr(10) + "D.O.B" + Chr(10) + Plyr_DOB$)
  ;AddGadgetItem(#IconGadget, 19, "D.O.B" + Chr(10) + Plyr_DOB$)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 19, "Nationality:" + Chr(10) + Nationality$)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 20, "Moral:" + Chr(10) + Plyr_Moral$)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 21, "Future:" + Chr(10) + Future$)
  SetGadgetItemColor(#IconGadget, 21, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 21, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
    Repeat
      Event = WaitWindowEvent()
  
    Until Event = #PB_Event_CloseWindow

EndProcedure
Last edited by Distorted Pixel on Thu Feb 16, 2023 3:33 am, edited 1 time in total.
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: 2nd drawn image not showing

Post by mk-soft »

Use only one StartDrawing ...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: 2nd drawn image not showing

Post by infratec »

First of all:
PB does not support layers and overlapping gadgets.

Next:
Your example is not runable.
I downloaded the picture, but it seams that this is not the real picture, it is already a screenshot.

What does you really want?
The picture as background and you want to add the other gadgets in foreground?

Btw. there is no ImageGadgetOutput(), only an ImageOutput()
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: 2nd drawn image not showing

Post by infratec »

Your y position of 900 was out of the image.

Code: Select all

Enumeration
  #ImgGadget  
  #IconGadget
  #EditGadget
  #GadgetItem
  #TxtGadget
EndEnumeration

Global NPC_Name.s = "Tony Pennock"
Global KP, TK, PS, SH, PC, HE, ST, SP, BC, FT
Global Plyr_Wage

Global Plyr_Val$, Contract_Exp$, Status$, League_Pay_Bonus, Promotion_Bonus, Cup_Win_Bonus, Cup_RU_Bonus, Win_Bonus, Goal_Bonus
Global Plyr_Age, Plyr_DOB$, Nationality$, Plyr_Moral$, Future$ : Global Plyr_Description.s

Plyr_Val$ = "10K" : Plyr_Wage = 230 : Contract_Exp$ = "23rd Jun '01" : Status$ = "Under Contract"
KP = 50 : TK = 25 : PS = 23 : SH = 11 : PC = 71 : HE = 23 : ST = 66 : SP = 31 : BC =26 : FT = 100
League_Pay_Bonus = 460 : Promotion_Bonus = 230 : Cup_Win_Bonus = 230 : Cup_RU_Bonus  = 110
Win_Bonus        = 23  : Goal_Bonus      = 23  : Plyr_Age      = 27  : Plyr_DOB$     = "10th April 1971"
Nationality$     = "Welsh"
Plyr_Moral$      = "Pleased"
Future$          = "Not worried"
Plyr_Description = "A safe goalkeeper. He's good on fits and spurts"

; player stat sheet include
Procedure PlayerStatsSheet()
  OpenWindow(0, 0, 0, 1024, 768, "Ultimate Football Manager", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | 
                                                              #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
  InitSprite()
  
  ;ImgFile = LoadImage(0, "Images/PlayerStatsSheet.png")
  ImgFile = CreateImage(#PB_Any, 1024, 768, 24, #Green)
  
  
  LoadFont(0, "Arial", 25);, #PB_Font_Bold)
  LoadFont(1, "Arial", 15)
  
  If StartDrawing(ImageOutput(ImgFile))
    DrawingFont(FontID(0))
    DrawText(5, 5, NPC_Name, $0025B8, $000000)
    
    DrawingFont(FontID(1))
    DrawText(5, 700, Plyr_Description, $0025B8, $000000)
    StopDrawing()
  EndIf
  
  ImageGadget(#ImgGadget, 0, 0, 0, 0, ImageID(ImgFile))
  DisableGadget(#ImgGadget, #True)
  
  LoadFont(2, "Arial", 11, #PB_Font_Bold)
  
  ListIconGadget(#IconGadget, 5, 65, 560, 500,"", 125, #LVS_NOCOLUMNHEADER); | #PB_ListIcon_GridLines)
  AddGadgetColumn(#IconGadget, 1, "", 100)                                 ; column 1
  AddGadgetColumn(#IconGadget, 2, "", 125)                                 ; column 2
  AddGadgetColumn(#IconGadget, 3, "", 125)                                 ; column 3
  SetGadgetColor(#IconGadget, #PB_Gadget_LineColor, $259F4B)  
  SetGadgetFont(#IconGadget, FontID(2))
  SetGadgetColor(#IconGadget, #PB_Gadget_BackColor, $000000) : SetGadgetColor(#IconGadget, #PB_Gadget_FrontColor, $0025B8)
  
  ; column 1
  AddGadgetItem(#IconGadget, 0, "Goalkeeper")
  AddGadgetItem(#IconGadget, 1, "")
  ; column 1                           column 2
  AddGadgetItem(#IconGadget, 2, "Keeping" + Chr(10) + KP + Chr(10) + "Heading" + Chr(10) + HE)
  SetGadgetItemColor(#IconGadget, 2, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 3, "Tackling" + Chr(10) + TK + Chr(10) + "Stamina" + Chr(10) + ST)
  SetGadgetItemColor(#IconGadget, 3, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 4, "Passing" + Chr(10) + PS + Chr(10) + "Set Plays" + Chr(10) + SP)
  SetGadgetItemColor(#IconGadget, 4, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 5, "Shooting" + Chr(10) + SH + Chr(10) + "Ball Control" + Chr(10) + BC)
  SetGadgetItemColor(#IconGadget, 5, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 6, "Pace" + Chr(10) + PC +Chr(10) + "Fitness" + Chr(10) + FT)
  SetGadgetItemColor(#IconGadget, 6, #PB_Gadget_FrontColor, $00A1B8)
  
  For item = 0 To CountGadgetItems(#IconGadget)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  Next
  
  AddGadgetItem(#IconGadget, 7, "")
  AddGadgetItem(#IconGadget, 8, "Contract Details")
  SetGadgetItemColor(#IconGadget, 8, #PB_Gadget_FrontColor, $0025B8)
  
  AddGadgetItem(#IconGadget, 9, "Value" + Chr(10) + Plyr_Val$ + Chr(10) + "Wages" + Chr(10) + Plyr_Wage)
  SetGadgetItemColor(#IconGadget, 9, #PB_Gadget_FrontColor, $00A1B8)
  
  For item = 0 To CountGadgetItems(#IconGadget)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  Next
  
  AddGadgetItem(#IconGadget, 10, "Contract Expiry" + Chr(10) + Chr(10) + Contract_Exp$)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $00A1B8)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $FFFFFF, 2)
  
  AddGadgetItem(#IconGadget, 11, "Status" + Chr(10) + Chr(10) + Status$)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $C3C3C3, 2)
  
  AddGadgetItem(#IconGadget, 12, "")
  AddGadgetItem(#IconGadget, 13, "Bonuses")
  
  AddGadgetItem(#IconGadget, 14, "League" + Chr(10) + League_Pay_Bonus + Chr(10) + "Promotion" + Chr(10) + Promotion_Bonus)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 15, "Cup Win" + Chr(10) + Cup_Win_Bonus + Chr(10) + "Cup R.U." + Chr(10) + Cup_RU_Bonus)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 16, "Win" + Chr(10) + Win_Bonus + Chr(10) + "Goal." + Chr(10) + Goal_Bonus)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 17, "")
  
  AddGadgetItem(#IconGadget, 18, "Age" + Chr(10) + Plyr_Age + Chr(10) + "D.O.B" + Chr(10) + Plyr_DOB$)
  ;AddGadgetItem(#IconGadget, 19, "D.O.B" + Chr(10) + Plyr_DOB$)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 19, "Nationality:" + Chr(10) + Nationality$)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 20, "Moral:" + Chr(10) + Plyr_Moral$)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 21, "Future:" + Chr(10) + Future$)
  SetGadgetItemColor(#IconGadget, 21, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 21, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  Repeat
    Event = WaitWindowEvent()
    
  Until Event = #PB_Event_CloseWindow
  
EndProcedure



UsePNGImageDecoder()

PlayerStatsSheet()
But it looks that your are using more then one event loop in your code. A bad decission.
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: 2nd drawn image not showing

Post by infratec »

You can use a CanvasGadget( ) as container, which is more PB compatible then placing gadgets on top of an image gadget.

And for what you are using InitSprite()?
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: 2nd drawn image not showing

Post by infratec »

With CanvasGadget() as Container:

Code: Select all

EnableExplicit

Enumeration
  #MainWindow
  #StatsWindow
EndEnumeration

Enumeration
  #StatsCanvas
  #StatsListIcon
  #EditGadget
  #GadgetItem
  #TxtGadget
EndEnumeration

Enumeration
  #Font25
  #Font15
  #Font11Bold
EndEnumeration


Global NPC_Name.s = " Tony Pennock "
Global KP, TK, PS, SH, PC, HE, ST, SP, BC, FT
Global Plyr_Wage
Global Plyr_Val$, Contract_Exp$, Status$, League_Pay_Bonus, Promotion_Bonus, Cup_Win_Bonus, Cup_RU_Bonus, Win_Bonus, Goal_Bonus
Global Plyr_Age, Plyr_DOB$, Nationality$, Plyr_Moral$, Future$
Global Plyr_Description.s


Plyr_Val$ = "10K" : Plyr_Wage = 230 : Contract_Exp$ = "23rd Jun '01" : Status$ = "Under Contract"
KP = 50 : TK = 25 : PS = 23 : SH = 11 : PC = 71 : HE = 23 : ST = 66 : SP = 31 : BC =26 : FT = 100
League_Pay_Bonus = 460 : Promotion_Bonus = 230 : Cup_Win_Bonus = 230 : Cup_RU_Bonus  = 110
Win_Bonus        = 23  : Goal_Bonus      = 23  : Plyr_Age      = 27  : Plyr_DOB$     = "10th April 1971"
Nationality$     = "Welsh"
Plyr_Moral$      = "Pleased"
Future$          = "Not worried"
Plyr_Description = " A safe goalkeeper. He's good on fits and spurts "

; player stat sheet include
Procedure PlayerStatsSheet()
  
  Protected.i ImgFile, item
  
  
  OpenWindow(#StatsWindow, 0, 0, 1024, 768, "Ultimate Football Manager", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget)
  CanvasGadget(#StatsCanvas, 0, 0, 1024, 768, #PB_Canvas_Container)
  
  ImgFile = CreateImage(#PB_Any, 1024, 768, 24, #Green)
  
  If StartDrawing(CanvasOutput(#StatsCanvas))
    DrawImage(ImageID(ImgFile), 0, 0)
    
    DrawingFont(FontID(#Font25))
    DrawText(5, 5, NPC_Name, $0025B8, $000000)
    
    DrawingFont(FontID(#Font15))
    DrawText(5, 700, Plyr_Description, $0025B8, $000000)
    
    StopDrawing()
  EndIf
  
  ListIconGadget(#StatsListIcon, 5, 65, 560, 500,"", 125, #LVS_NOCOLUMNHEADER); | #PB_ListIcon_GridLines)
  AddGadgetColumn(#StatsListIcon, 1, "", 100)                                 ; column 1
  AddGadgetColumn(#StatsListIcon, 2, "", 125)                                 ; column 2
  AddGadgetColumn(#StatsListIcon, 3, "", 125)                                 ; column 3
  SetGadgetColor(#StatsListIcon, #PB_Gadget_LineColor, $259F4B)
  SetGadgetFont(#StatsListIcon, FontID(#Font11Bold))
  SetGadgetColor(#StatsListIcon, #PB_Gadget_BackColor, $000000) : SetGadgetColor(#StatsListIcon, #PB_Gadget_FrontColor, $0025B8)
  
  ; column 1
  AddGadgetItem(#StatsListIcon, 0, "Goalkeeper")
  AddGadgetItem(#StatsListIcon, 1, "")
  ; column 1                           column 2
  AddGadgetItem(#StatsListIcon, 2, "Keeping" + #LF$ + KP + #LF$ + "Heading" + #LF$ + HE)
  SetGadgetItemColor(#StatsListIcon, 2, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#StatsListIcon, 3, "Tackling" + #LF$ + TK + #LF$ + "Stamina" + #LF$ + ST)
  SetGadgetItemColor(#StatsListIcon, 3, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#StatsListIcon, 4, "Passing" + #LF$ + PS + #LF$ + "Set Plays" + #LF$ + SP)
  SetGadgetItemColor(#StatsListIcon, 4, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#StatsListIcon, 5, "Shooting" + #LF$ + SH + #LF$ + "Ball Control" + #LF$ + BC)
  SetGadgetItemColor(#StatsListIcon, 5, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#StatsListIcon, 6, "Pace" + #LF$ + PC +#LF$ + "Fitness" + #LF$ + FT)
  SetGadgetItemColor(#StatsListIcon, 6, #PB_Gadget_FrontColor, $00A1B8)
  
  For item = 0 To CountGadgetItems(#StatsListIcon)
    SetGadgetItemColor(#StatsListIcon,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#StatsListIcon,-1,#PB_Gadget_FrontColor,$FFFFFF,3)
  Next
  
  AddGadgetItem(#StatsListIcon, 7, "")
  AddGadgetItem(#StatsListIcon, 8, "Contract Details")
  SetGadgetItemColor(#StatsListIcon, 8, #PB_Gadget_FrontColor, $0025B8)
  
  AddGadgetItem(#StatsListIcon, 9, "Value" + #LF$ + Plyr_Val$ + #LF$ + "Wages" + #LF$ + Plyr_Wage)
  SetGadgetItemColor(#StatsListIcon, 9, #PB_Gadget_FrontColor, $00A1B8)
  
  For item = 0 To CountGadgetItems(#StatsListIcon)
    SetGadgetItemColor(#StatsListIcon,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#StatsListIcon,-1,#PB_Gadget_FrontColor,$FFFFFF,3)
  Next
  
  AddGadgetItem(#StatsListIcon, 10, "Contract Expiry" + #LF$ + #LF$ + Contract_Exp$)
  SetGadgetItemColor(#StatsListIcon, 10, #PB_Gadget_FrontColor, $00A1B8)
  SetGadgetItemColor(#StatsListIcon, 10, #PB_Gadget_FrontColor, $FFFFFF, 2)
  
  AddGadgetItem(#StatsListIcon, 11, "Status" + #LF$ + #LF$ + Status$)
  SetGadgetItemColor(#StatsListIcon, 11, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#StatsListIcon, 11, #PB_Gadget_FrontColor, $C3C3C3, 2)
  
  AddGadgetItem(#StatsListIcon, 12, "")
  AddGadgetItem(#StatsListIcon, 13, "Bonuses")
  
  AddGadgetItem(#StatsListIcon, 14, "League" + #LF$ + League_Pay_Bonus + #LF$ + "Promotion" + #LF$ + Promotion_Bonus)
  SetGadgetItemColor(#StatsListIcon, 14, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#StatsListIcon, 14, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#StatsListIcon, 14, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#StatsListIcon, 14, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#StatsListIcon, 15, "Cup Win" + #LF$ + Cup_Win_Bonus + #LF$ + "Cup R.U." + #LF$ + Cup_RU_Bonus)
  SetGadgetItemColor(#StatsListIcon, 15, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#StatsListIcon, 15, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#StatsListIcon, 15, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#StatsListIcon, 15, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#StatsListIcon, 16, "Win" + #LF$ + Win_Bonus + #LF$ + "Goal." + #LF$ + Goal_Bonus)
  SetGadgetItemColor(#StatsListIcon, 16, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#StatsListIcon, 16, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#StatsListIcon, 16, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#StatsListIcon, 16, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#StatsListIcon, 17, "")
  
  AddGadgetItem(#StatsListIcon, 18, "Age" + #LF$ + Plyr_Age + #LF$ + "D.O.B" + #LF$ + Plyr_DOB$)
  ;AddGadgetItem(#StatsListIcon, 19, "D.O.B" + #LF$ + Plyr_DOB$)
  SetGadgetItemColor(#StatsListIcon, 18, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#StatsListIcon, 18, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#StatsListIcon, 18, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#StatsListIcon, 18, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#StatsListIcon, 19, "Nationality:" + #LF$ + Nationality$)
  SetGadgetItemColor(#StatsListIcon, 19, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#StatsListIcon, 19, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#StatsListIcon, 20, "Moral:" + #LF$ + Plyr_Moral$)
  SetGadgetItemColor(#StatsListIcon, 20, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#StatsListIcon, 20, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#StatsListIcon, 21, "Future:" + #LF$ + Future$)
  SetGadgetItemColor(#StatsListIcon, 21, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#StatsListIcon, 21, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  CloseGadgetList()
  
EndProcedure




Procedure.i ProcessStatsWindowEvents(Event.i)
  
  Protected.i Result
  
  
  Select Event
    Case #PB_Event_CloseWindow
      CloseWindow(#StatsWindow)
      Result = #True
  EndSelect
  
  ProcedureReturn Result
  
EndProcedure




Define.i Event, Exit

UsePNGImageDecoder()

LoadFont(#Font25, "Arial", 25)
LoadFont(#Font15, "Arial", 15)
LoadFont(#Font11Bold, "Arial", 11, #PB_Font_Bold)

PlayerStatsSheet()

Repeat
  Event = WaitWindowEvent()
  Select EventWindow()
    Case #StatsWindow
      Exit = ProcessStatsWindowEvents(Event)
  EndSelect
Until Exit

FreeFont(#Font11Bold)
FreeFont(#Font15)
FreeFont(#Font25)
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: 2nd drawn image not showing

Post by Distorted Pixel »

mk-soft wrote: Wed Feb 08, 2023 9:24 am Use only one StartDrawing ...
I'll try that, thank you
First of all:
PB does not support layers and overlapping gadgets.

Next:
Your example is not runable.
I downloaded the picture, but it seams that this is not the real picture, it is already a screenshot.

What does you really want?
The picture as background and you want to add the other gadgets in foreground?

Btw. there is no ImageGadgetOutput(), only an ImageOutput()
Top
Yes, I know PB doesn't support layers.
Yes I want the image I'm using as the background and place gadgets over it.

I'm sorry, every now and then acccidently post code that doesn't work as is. This time for some weird reason I couldn't get a working code seperate from my original code. It kept telling me that the "Image is not initialized" at the first line of drawing to first image, so I just posted my procedure.
Btw: There isn't a command called ImageGadgetOutput()

This image is public domain from pixabay.com
here is the background image:
https://mega.nz/file/Bsl32ZyJ#Fzs23Rz1z ... Dnw5yfvo10
Your y position of 900 was out of the image.
If you're refering to that the y position is outside of the ListIconGadget, Yes, it is, but I don't want to put it on top of the ListIconGadget. I want it below it. I originally wanted the text inside the ListIconGadget, but to my knowledge you can't change the size of just one cell inside the ListIconGadget without pushing the other cells in the same row out of view. You also can't make any cell multi-line so all other cells in the row stay in view either. So I'm stuck either puting another gadget in with the text in it or drawing an image and desplaying it that way. I chose the image for now.
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: 2nd drawn image not showing

Post by Distorted Pixel »

Thank you all for your help. I was able to use only one drawing routine for both as suggested by mk-soft.
Below is the piece of code I was able to put in my procedure and it works great. Thank you all again.

Code: Select all

  InitSprite()
  
    ImgFile = LoadImage(0, "Images/PlayerStatsSheet.png")
      ImageGadget(#ImgGadget, 0, 0, 1024, 768, ImgFile)
      DisableGadget(#ImgGadget, #True)
      
      LoadFont(0, "Media/nevis.ttf", 25);, #PB_Font_Bold)
      LoadFont(1, "Media/nevis.ttf", 15)
    If StartDrawing(ImageOutput(#ImgGadget))
      DrawingFont(FontID(0))
      DrawText(5, 5, NPC_Name, $0025B8, $000000)
      DrawingFont(FontID(1))
      DrawText(5, 600, Plyr_Description, $0025B8, $000000)
      StopDrawing()
    EndIf
   FreeFont(1)
      ImageGadget(#ImgGadget, 0, 0, WindowWidth(0), WindowHeight(0), ImageID(0))
      DisableGadget(#ImgGadget, #True)
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: 2nd drawn image not showing

Post by infratec »

Your code ist still not correct. It works by luck.

Code: Select all

ImageGadget(#ImgGadget, 0, 0, 1024, 768, ImgFile)
Should be

Code: Select all

ImageGadget(#ImgGadget, 0, 0, 1024, 768, ImageID(ImgFile))
And you can not draw to an ImageGadget

Code: Select all

StartDrawing(ImageOutput(#ImgGadget))
You can use it only on images.

The second craetion ogf the ImageGadget() is only time consuming and not needed.
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: 2nd drawn image not showing

Post by Distorted Pixel »

infratec wrote: Wed Feb 08, 2023 6:01 pm Your code ist still not correct. It works by luck.

Should be

Code: Select all

ImageGadget(#ImgGadget, 0, 0, 1024, 768, ImageID(ImgFile))
And you can not draw to an ImageGadget

Code: Select all

StartDrawing(ImageOutput(#ImgGadget))
You can use it only on images.

The second craetion ogf the ImageGadget() is only time consuming and not needed.
I have tried now and other times also what you are saying how it should be with ImageID(ImgFile)), but it doesn't work with that, I get an error.
"The specified #Image is not initialized"

In my original code the image number is being set to the variable ImgFile. That is the only way it works.

As for the drawing to an image, I have tried a simple TextGadget() to no avail, even with setting the back color to transparent. Drawing the text to an image is the only way it has worked.

I also took out the following event loop from one place and moved the other one that is the same code to the bottom and everyting works. As someone said above there was no need for 2 of the same event loops.

Code: Select all

  For item = 0 To CountGadgetItems(#IconGadget)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  Next
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: 2nd drawn image not showing

Post by Distorted Pixel »

So, the complete code that works now is here:

Code: Select all

Enumeration
  #ImgGadget  
  #IconGadget
  #EditGadget
  #GadgetItem
  #TxtGadget
EndEnumeration

Global NPC_Name.s = "Tony Pennock"
Global KP, TK, PS, SH, PC, HE, ST, SP, BC, FT
Global Plyr_Wage

Global Plyr_Val$, Contract_Exp$, Status$, League_Pay_Bonus, Promotion_Bonus, Cup_Win_Bonus, Cup_RU_Bonus, Win_Bonus, Goal_Bonus
Global Plyr_Age, Plyr_DOB$, Nationality$, Plyr_Moral$, Future$ : Global Plyr_Description.s

Plyr_Val$ = "10K" : Plyr_Wage = 230 : Contract_Exp$ = "23rd Jun '01" : Status$ = "Under Contract"
KP = 50 : TK = 25 : PS = 23 : SH = 11 : PC = 71 : HE = 23 : ST = 66 : SP = 31 : BC =26 : FT = 100
League_Pay_Bonus = 460 : Promotion_Bonus = 230 : Cup_Win_Bonus = 230 : Cup_RU_Bonus  = 110
Win_Bonus        = 23  : Goal_Bonus      = 23  : Plyr_Age      = 27  : Plyr_DOB$     = "10th April 1971"
Nationality$     = "Welsh"
Plyr_Moral$      = "Pleased"
Future$          = "Not worried"
Plyr_Description = "A safe goalkeeper. He's good in fits and spurts"

; player stat sheet include
Procedure PlayerStatsSheet()
  OpenWindow(0, 0, 0, 1024, 768, "Ultimate Football Manager", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | 
                                                              #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
  InitSprite()
  
    ImgFile = LoadImage(0, "Images/PlayerStatsSheet.png")
      ImageGadget(#ImgGadget, 0, 0, 1024, 768, ImgFile)
      DisableGadget(#ImgGadget, #True)
      
      LoadFont(0, "Media/nevis.ttf", 25);, #PB_Font_Bold)
      LoadFont(1, "Media/nevis.ttf", 15)
    If StartDrawing(ImageOutput(#ImgGadget))
      DrawingFont(FontID(0))
      DrawText(5, 5, NPC_Name, $0025B8, $000000)
      DrawingFont(FontID(1))
      DrawText(5, 575, Plyr_Description, $0025B8, $000000)
      StopDrawing()
    EndIf
   FreeFont(1)
      ImageGadget(#ImgGadget, 0, 0, WindowWidth(0), WindowHeight(0), ImageID(0))
      DisableGadget(#ImgGadget, #True)
      
      LoadFont(0, "Media/nevis.ttf", 11, #PB_Font_Bold)
      
  ListIconGadget(#IconGadget, 5, 65, 560, 500,"", 130, #LVS_NOCOLUMNHEADER); | #PB_ListIcon_GridLines)
  AddGadgetColumn(#IconGadget, 1, "", 100) ; column 1
  AddGadgetColumn(#IconGadget, 2, "", 125) ; column 2
  AddGadgetColumn(#IconGadget, 3, "", 125) ; column 3
  SetGadgetColor(#IconGadget, #PB_Gadget_LineColor, $259F4B)  
  SetGadgetFont(#IconGadget, FontID(0))
  SetGadgetColor(#IconGadget, #PB_Gadget_BackColor, $000000) : SetGadgetColor(#IconGadget, #PB_Gadget_FrontColor, $0025B8)
  
  ; column 0
  AddGadgetItem(#IconGadget, 0, "Goalkeeper")
  AddGadgetItem(#IconGadget, 1, "")
                                ; column 1                           column 3
  AddGadgetItem(#IconGadget, 2, "Keeping" + Chr(10) + KP + Chr(10) + "Heading" + Chr(10) + HE)
  SetGadgetItemColor(#IconGadget, 2, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 3, "Tackling" + Chr(10) + TK + Chr(10) + "Stamina" + Chr(10) + ST)
  SetGadgetItemColor(#IconGadget, 3, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 4, "Passing" + Chr(10) + PS + Chr(10) + "Set Plays" + Chr(10) + SP)
  SetGadgetItemColor(#IconGadget, 4, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 5, "Shooting" + Chr(10) + SH + Chr(10) + "Ball Control" + Chr(10) + BC)
  SetGadgetItemColor(#IconGadget, 5, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 6, "Pace" + Chr(10) + PC +Chr(10) + "Fitness" + Chr(10) + FT)
  SetGadgetItemColor(#IconGadget, 6, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 7, "")
  AddGadgetItem(#IconGadget, 8, "Contract Details")
  SetGadgetItemColor(#IconGadget, 8, #PB_Gadget_FrontColor, $0025B8)
  
  AddGadgetItem(#IconGadget, 9, "Value" + Chr(10) + Plyr_Val$ + Chr(10) + "Wages" + Chr(10) + Plyr_Wage)
  SetGadgetItemColor(#IconGadget, 9, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 10, "Contract Expires" + Chr(10) + Chr(10) + Contract_Exp$)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $00A1B8)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $FFFFFF, 2)
  
  AddGadgetItem(#IconGadget, 11, "Status" + Chr(10) + Chr(10) + Status$)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $C3C3C3, 2)
  
  AddGadgetItem(#IconGadget, 12, "")
  AddGadgetItem(#IconGadget, 13, "Bonuses")
  
  AddGadgetItem(#IconGadget, 14, "League" + Chr(10) + League_Pay_Bonus + Chr(10) + "Promotion" + Chr(10) + Promotion_Bonus)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 15, "Cup Win" + Chr(10) + Cup_Win_Bonus + Chr(10) + "Cup R.U." + Chr(10) + Cup_RU_Bonus)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 16, "Win" + Chr(10) + Win_Bonus + Chr(10) + "Goal." + Chr(10) + Goal_Bonus)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 17, "")
  
  AddGadgetItem(#IconGadget, 18, "Age" + Chr(10) + Plyr_Age + Chr(10) + "D.O.B" + Chr(10) + Plyr_DOB$)
  ;AddGadgetItem(#IconGadget, 19, "D.O.B" + Chr(10) + Plyr_DOB$)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 19, "Nationality:" + Chr(10) + Nationality$)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 20, "Moral:" + Chr(10) + Plyr_Moral$)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 21, "Future:" + Chr(10) + Future$)
  SetGadgetItemColor(#IconGadget, 21, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 21, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  For item = 0 To CountGadgetItems(#IconGadget)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  Next
  
    Repeat
      Event = WaitWindowEvent()
  
    Until Event = #PB_Event_CloseWindow

EndProcedure

To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: 2nd drawn image not showing

Post by infratec »

Distorted Pixel wrote: Wed Feb 08, 2023 10:12 pm
I have tried now and other times also what you are saying how it should be with ImageID(ImgFile)), but it doesn't work with that, I get an error.
"The specified #Image is not initialized"

In my original code the image number is being set to the variable ImgFile. That is the only way it works.

As for the drawing to an image, I have tried a simple TextGadget() to no avail, even with setting the back color to transparent. Drawing the text to an image is the only way it has worked.
Yes, because your code is simply wrong.

Code: Select all

ImgFile = LoadImage(0, "Images/PlayerStatsSheet.png")
Your created image has the number 0
ImgFile in this case means only it was Ok or not Ok.
The right way, when you use a variable in front is:

Code: Select all

ImgFile = LoadImage(#PB_Any, "Images/PlayerStatsSheet.png")
Then

Code: Select all

ImageGadget(#ImgGadget, 0, 0, 1024, 768, ImageID(ImgFile))
works as it should.

As I already told and showed you:
The way to go in PB when you want to place a Gadget over a Gadget is to use a CanvasGadget as backround and container.
Working with an ImageGadget below other gadgets is not guaranted to always work.

Only to show that it works:

Code: Select all

Enumeration
  #ImgGadget  
  #IconGadget
  #EditGadget
  #GadgetItem
  #TxtGadget
EndEnumeration

Global NPC_Name.s = "Tony Pennock"
Global KP, TK, PS, SH, PC, HE, ST, SP, BC, FT
Global Plyr_Wage

Global Plyr_Val$, Contract_Exp$, Status$, League_Pay_Bonus, Promotion_Bonus, Cup_Win_Bonus, Cup_RU_Bonus, Win_Bonus, Goal_Bonus
Global Plyr_Age, Plyr_DOB$, Nationality$, Plyr_Moral$, Future$ : Global Plyr_Description.s

Plyr_Val$ = "10K" : Plyr_Wage = 230 : Contract_Exp$ = "23rd Jun '01" : Status$ = "Under Contract"
KP = 50 : TK = 25 : PS = 23 : SH = 11 : PC = 71 : HE = 23 : ST = 66 : SP = 31 : BC =26 : FT = 100
League_Pay_Bonus = 460 : Promotion_Bonus = 230 : Cup_Win_Bonus = 230 : Cup_RU_Bonus  = 110
Win_Bonus        = 23  : Goal_Bonus      = 23  : Plyr_Age      = 27  : Plyr_DOB$     = "10th April 1971"
Nationality$     = "Welsh"
Plyr_Moral$      = "Pleased"
Future$          = "Not worried"
Plyr_Description = "A safe goalkeeper. He's good in fits and spurts"

; player stat sheet include
Procedure PlayerStatsSheet()
  OpenWindow(0, 0, 0, 1024, 768, "Ultimate Football Manager", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | 
                                                              #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
  ;InitSprite()
  
  ImgFile = LoadImage(#PB_Any, "Images/PlayerStatsSheet.png")
;   ImageGadget(#ImgGadget, 0, 0, 1024, 768, ImageID(ImgFile))
;   DisableGadget(#ImgGadget, #True)
  
  LoadFont(0, "Media/nevis.ttf", 25);, #PB_Font_Bold)
  LoadFont(1, "Media/nevis.ttf", 15)
  If StartDrawing(ImageOutput(ImgFile))
    DrawingFont(FontID(0))
    DrawText(5, 5, NPC_Name, $0025B8, $000000)
    DrawingFont(FontID(1))
    DrawText(5, 575, Plyr_Description, $0025B8, $000000)
    StopDrawing()
  EndIf
  FreeFont(1)
  ImageGadget(#ImgGadget, 0, 0, 0, 0, ImageID(ImgFile))
  DisableGadget(#ImgGadget, #True)
  
  LoadFont(0, "Media/nevis.ttf", 11, #PB_Font_Bold)
  
  ListIconGadget(#IconGadget, 5, 65, 560, 500,"", 130, #LVS_NOCOLUMNHEADER); | #PB_ListIcon_GridLines)
  AddGadgetColumn(#IconGadget, 1, "", 100)                                 ; column 1
  AddGadgetColumn(#IconGadget, 2, "", 125)                                 ; column 2
  AddGadgetColumn(#IconGadget, 3, "", 125)                                 ; column 3
  SetGadgetColor(#IconGadget, #PB_Gadget_LineColor, $259F4B)  
  SetGadgetFont(#IconGadget, FontID(0))
  SetGadgetColor(#IconGadget, #PB_Gadget_BackColor, $000000) : SetGadgetColor(#IconGadget, #PB_Gadget_FrontColor, $0025B8)
  
  ; column 0
  AddGadgetItem(#IconGadget, 0, "Goalkeeper")
  AddGadgetItem(#IconGadget, 1, "")
  ; column 1                           column 3
  AddGadgetItem(#IconGadget, 2, "Keeping" + Chr(10) + KP + Chr(10) + "Heading" + Chr(10) + HE)
  SetGadgetItemColor(#IconGadget, 2, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 3, "Tackling" + Chr(10) + TK + Chr(10) + "Stamina" + Chr(10) + ST)
  SetGadgetItemColor(#IconGadget, 3, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 4, "Passing" + Chr(10) + PS + Chr(10) + "Set Plays" + Chr(10) + SP)
  SetGadgetItemColor(#IconGadget, 4, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 5, "Shooting" + Chr(10) + SH + Chr(10) + "Ball Control" + Chr(10) + BC)
  SetGadgetItemColor(#IconGadget, 5, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 6, "Pace" + Chr(10) + PC +Chr(10) + "Fitness" + Chr(10) + FT)
  SetGadgetItemColor(#IconGadget, 6, #PB_Gadget_FrontColor, $00A1B8)
  
  ;   For item = 0 To CountGadgetItems(#IconGadget)
  ;     SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
  ;     SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  ;   Next
  
  AddGadgetItem(#IconGadget, 7, "")
  AddGadgetItem(#IconGadget, 8, "Contract Details")
  SetGadgetItemColor(#IconGadget, 8, #PB_Gadget_FrontColor, $0025B8)
  
  AddGadgetItem(#IconGadget, 9, "Value" + Chr(10) + Plyr_Val$ + Chr(10) + "Wages" + Chr(10) + Plyr_Wage)
  SetGadgetItemColor(#IconGadget, 9, #PB_Gadget_FrontColor, $00A1B8)
  
  ;   For item = 0 To CountGadgetItems(#IconGadget)
  ;     SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
  ;     SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  ;   Next
  
  AddGadgetItem(#IconGadget, 10, "Contract Expires" + Chr(10) + Chr(10) + Contract_Exp$)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $00A1B8)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $FFFFFF, 2)
  
  AddGadgetItem(#IconGadget, 11, "Status" + Chr(10) + Chr(10) + Status$)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $C3C3C3, 2)
  
  AddGadgetItem(#IconGadget, 12, "")
  AddGadgetItem(#IconGadget, 13, "Bonuses")
  
  AddGadgetItem(#IconGadget, 14, "League" + Chr(10) + League_Pay_Bonus + Chr(10) + "Promotion" + Chr(10) + Promotion_Bonus)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 15, "Cup Win" + Chr(10) + Cup_Win_Bonus + Chr(10) + "Cup R.U." + Chr(10) + Cup_RU_Bonus)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 16, "Win" + Chr(10) + Win_Bonus + Chr(10) + "Goal." + Chr(10) + Goal_Bonus)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 17, "")
  
  AddGadgetItem(#IconGadget, 18, "Age" + Chr(10) + Plyr_Age + Chr(10) + "D.O.B" + Chr(10) + Plyr_DOB$)
  ;AddGadgetItem(#IconGadget, 19, "D.O.B" + Chr(10) + Plyr_DOB$)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 19, "Nationality:" + Chr(10) + Nationality$)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 20, "Moral:" + Chr(10) + Plyr_Moral$)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 21, "Future:" + Chr(10) + Future$)
  SetGadgetItemColor(#IconGadget, 21, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 21, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  For item = 0 To CountGadgetItems(#IconGadget)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  Next
  
  Repeat
    Event = WaitWindowEvent()
    
  Until Event = #PB_Event_CloseWindow
  
EndProcedure


UsePNGImageDecoder()
PlayerStatsSheet()
Last edited by infratec on Wed Feb 08, 2023 10:46 pm, edited 1 time in total.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: 2nd drawn image not showing

Post by RASHAD »

My 5 cents :)

Code: Select all

UsePNGImageDecoder()

Enumeration
  #ImgGadget  
  #IconGadget
  #EditGadget
  #GadgetItem
  #Goalkeeper
EndEnumeration

Global NPC_Name.s = "Tony Pennock"
Global KP, TK, PS, SH, PC, HE, ST, SP, BC, FT
Global Plyr_Wage

Global Plyr_Val$, Contract_Exp$, Status$, League_Pay_Bonus, Promotion_Bonus, Cup_Win_Bonus, Cup_RU_Bonus, Win_Bonus, Goal_Bonus
Global Plyr_Age, Plyr_DOB$, Nationality$, Plyr_Moral$, Future$ : Global Plyr_Description.s

Plyr_Val$ = "10K" : Plyr_Wage = 230 : Contract_Exp$ = "23rd Jun '01" : Status$ = "Under Contract"
KP = 50 : TK = 25 : PS = 23 : SH = 11 : PC = 71 : HE = 23 : ST = 66 : SP = 31 : BC =26 : FT = 100
League_Pay_Bonus = 460 : Promotion_Bonus = 230 : Cup_Win_Bonus = 230 : Cup_RU_Bonus  = 110
Win_Bonus        = 23  : Goal_Bonus      = 23  : Plyr_Age      = 27  : Plyr_DOB$     = "10th April 1971"
Nationality$     = "Welsh"
Plyr_Moral$      = "Pleased"
Future$          = "Not worried"
Plyr_Description = "A safe goalkeeper. He's good on fits and spurts"

; player stat sheet include
Procedure PlayerStatsSheet()
  OpenWindow(0, 0, 0, 1024, 768, "Ultimate Football Manager", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | 
                                                              #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget|#PB_Window_Invisible)
  ;InitSprite()
  
    ImgFile = LoadImage(0, GetTemporaryDirectory()+"PlayerStatsSheet1.png")
     
    LoadFont(0, "Media/nevis.ttf", 25);, #PB_Font_Bold)
    LoadFont(1, "Media/nevis.ttf", 15);, #PB_Font_Bold)
    
    If StartDrawing(ImageOutput(0))
      DrawingFont(FontID(0))
      DrawingMode(#PB_2DDrawing_Transparent)
      DrawText(5, 5, NPC_Name, $0025B8, $000000)
      StopDrawing()
    EndIf 
    
    CreateImage(10,600,24,24,$000000)
    StartDrawing(ImageOutput(10))
      DrawingFont(FontID(1))
      DrawText(0,0, Plyr_Description, $0025B8, $000000)
    StopDrawing()  
    
    FreeFont(0)
    FreeFont(1)
   
    ImageGadget(#ImgGadget, 0, 0, WindowWidth(0), WindowHeight(0), ImageID(0))
    DisableGadget(#ImgGadget, #True)  
       
    LoadFont(0, "Media/nevis.ttf", 11, #PB_Font_Bold)
      
  ListIconGadget(#IconGadget, 5, 65, 560, 500,"", 125, #LVS_NOCOLUMNHEADER); | #PB_ListIcon_GridLines)
  AddGadgetColumn(#IconGadget, 1, "", 100) ; column 1
  AddGadgetColumn(#IconGadget, 2, "", 125) ; column 2
  AddGadgetColumn(#IconGadget, 3, "", 125) ; column 3
  SetGadgetColor(#IconGadget, #PB_Gadget_LineColor, $259F4B)  
  SetGadgetFont(#IconGadget, FontID(0))
  SetGadgetColor(#IconGadget, #PB_Gadget_BackColor, $000000) : SetGadgetColor(#IconGadget, #PB_Gadget_FrontColor, $0025B8)
  
  ; column 1
  AddGadgetItem(#IconGadget, 0, "Goalkeeper")
  AddGadgetItem(#IconGadget, 1, "")
                                ; column 1                           column 2
  AddGadgetItem(#IconGadget, 2, "Keeping" + Chr(10) + KP + Chr(10) + "Heading" + Chr(10) + HE)
  SetGadgetItemColor(#IconGadget, 2, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 3, "Tackling" + Chr(10) + TK + Chr(10) + "Stamina" + Chr(10) + ST)
  SetGadgetItemColor(#IconGadget, 3, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 4, "Passing" + Chr(10) + PS + Chr(10) + "Set Plays" + Chr(10) + SP)
  SetGadgetItemColor(#IconGadget, 4, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 5, "Shooting" + Chr(10) + SH + Chr(10) + "Ball Control" + Chr(10) + BC)
  SetGadgetItemColor(#IconGadget, 5, #PB_Gadget_FrontColor, $00A1B8)
  
  AddGadgetItem(#IconGadget, 6, "Pace" + Chr(10) + PC +Chr(10) + "Fitness" + Chr(10) + FT)
  SetGadgetItemColor(#IconGadget, 6, #PB_Gadget_FrontColor, $00A1B8)
  
  For item = 0 To CountGadgetItems(#IconGadget)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  Next
  
  AddGadgetItem(#IconGadget, 7, "")
  AddGadgetItem(#IconGadget, 8, "Contract Details")
  SetGadgetItemColor(#IconGadget, 8, #PB_Gadget_FrontColor, $0025B8)
  
  AddGadgetItem(#IconGadget, 9, "Value" + Chr(10) + Plyr_Val$ + Chr(10) + "Wages" + Chr(10) + Plyr_Wage)
  SetGadgetItemColor(#IconGadget, 9, #PB_Gadget_FrontColor, $00A1B8)
  
  For item = 0 To CountGadgetItems(#IconGadget)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,1)
    SetGadgetItemColor(#IconGadget,-1,#PB_Gadget_FrontColor,$FFFFFF,3)    
  Next
  
  AddGadgetItem(#IconGadget, 10, "Contract Expiry" + Chr(10) + Chr(10) + Contract_Exp$)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $00A1B8)
  SetGadgetItemColor(#IconGadget, 10, #PB_Gadget_FrontColor, $FFFFFF, 2)
  
  AddGadgetItem(#IconGadget, 11, "Status" + Chr(10) + Chr(10) + Status$)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 11, #PB_Gadget_FrontColor, $C3C3C3, 2)
  
  AddGadgetItem(#IconGadget, 12, "")
  AddGadgetItem(#IconGadget, 13, "Bonuses")
  
  AddGadgetItem(#IconGadget, 14, "League" + Chr(10) + League_Pay_Bonus + Chr(10) + "Promotion" + Chr(10) + Promotion_Bonus)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 14, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 15, "Cup Win" + Chr(10) + Cup_Win_Bonus + Chr(10) + "Cup R.U." + Chr(10) + Cup_RU_Bonus)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 15, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 16, "Win" + Chr(10) + Win_Bonus + Chr(10) + "Goal." + Chr(10) + Goal_Bonus)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 16, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 17, "")
  
  AddGadgetItem(#IconGadget, 18, "Age" + Chr(10) + Plyr_Age + Chr(10) + "D.O.B" + Chr(10) + Plyr_DOB$)
  ;AddGadgetItem(#IconGadget, 19, "D.O.B" + Chr(10) + Plyr_DOB$)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 1)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $00A1B8, 2)
  SetGadgetItemColor(#IconGadget, 18, #PB_Gadget_FrontColor, $FFFFFF, 3)
  
  AddGadgetItem(#IconGadget, 19, "Nationality:" + Chr(10) + Nationality$)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 19, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 20, "Moral:" + Chr(10) + Plyr_Moral$)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $00A1B8, 0)
  SetGadgetItemColor(#IconGadget, 20, #PB_Gadget_FrontColor, $FFFFFF, 1)
  
  AddGadgetItem(#IconGadget, 21, "Future:" + Chr(10) + Future$)
  
  ImageGadget(#Goalkeeper,0,0,600,24,ImageID(10))
  SetWindowLongPtr_( GadgetID(#Goalkeeper), #GWL_HWNDPARENT,GadgetID(#IconGadget))
  HideWindow(0,0)
    Repeat
      Event = WaitWindowEvent()
  
    Until Event = #PB_Event_CloseWindow

EndProcedure

PlayerStatsSheet()

Egypt my love
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: 2nd drawn image not showing

Post by Distorted Pixel »

I think I understand? Don't load exact image numbers such as "0", "1", "2" into a variable. If I use a variable then use #PB_Any.

@ Infratec
I have actually used the CanvasGadget earlier in my program on another menu. I'm learning more and more over time. Your code works great and I thank you.

@RASHAD
I tried to run your code and I'll need to change a few things like directory etc etc for it to work. I will check it out also. You have helped me a month or 2 ago and I thank you also.

My coding is starting to get better and resemble a better coder, but I still have A LOT to learn.
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
Post Reply