Error Messages

Just starting out? Need help? Post your questions and find answers here.
Zooker
User
User
Posts: 22
Joined: Sun Apr 27, 2003 1:46 am
Location: So.Illinois USA

Error Messages

Post by Zooker »

Where can I find our where a deprecated function is? Half the examples and snippets of code come up with a deprecated function call or
so itseems. Also I tried the visual designer and it came up with a mountai of code to just display a simple Large bmp file; yet never showed the bmp file. This is very discouraging to a noobie like me!
It took 73 years for me to get this Stupid!
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

could you pse decide using one account only?

... CreateGadgetList() should be the depreciated function...
oh... and have a nice day.
rrpl
Enthusiast
Enthusiast
Posts: 121
Joined: Fri Apr 18, 2008 7:22 am
Location: Australia

Post by rrpl »

Code: Select all

; open bmp file
Procedure ShowABitmap()
  Protected Graphic.s,Gad1,Win,OrigWidth,OrigHeight,NewHeight,NewWidth,LoadedImage,ResizedImage,Quit
  Graphic=OpenFileRequester("Open a Bitmap File","","Bitmap Files (*.bmp)|*.bmp",0)
  If Graphic
    LoadedImage=LoadImage(#PB_Any,Graphic)
    
    ; let keep size proportions
    OrigWidth=ImageWidth(LoadedImage)
    OrigHeight=ImageHeight(LoadedImage)
    NewHeight = (640 * OrigHeight) / OrigWidth
    NewWidth = 640
    If NewHeight > PicHeight
      NewWidth = (480 * OrigWidth) / OrigHeight
      NewHeight = 480
    EndIf
    ; end size proportions, I hope I remembered it correctly!
    
    ResizedImage=ResizeImage(LoadedImage,NewWidth,NewHeight)
    Win=OpenWindow(#PB_Any,0,0,640,480,"Test",#PB_Window_ScreenCentered)
    Gad1=ImageGadget(#PB_Any,0,0,WindowWidth(Win),WindowHeight(Win),ResizedImage)
  Repeat
      If GetAsyncKeyState_(#VK_ESCAPE): Quit = 1 :EndIf
      If WindowEvent()=16: Quit=1:EndIf

    Until Quit=1
  EndIf
EndProcedure

ShowABitmap()
Heres a little example function that covers most of it, including resizing the image in proportion.

I would advise you to concentrate on starting on very simple projects at first without using a visual designer. Once you understand how the process works then you will understand the code the visual designer is generating and be able to use it properly. Also when you have a problem best to show the code that you have created/generated, so that others can tell you what is wrong with it.
"What you are is what you have been. What you’ll be is what you do now.” -Buddha
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Image
Hot Pockets
User
User
Posts: 51
Joined: Mon Jun 01, 2009 3:56 am

Deprecation

Post by Hot Pockets »

Mr Gaman
I do think I have that problemed solved. To all thanks fro the help. How ever I still don't know what a deprecated function is? I do beleive I have thought of away to display a Title on my bmp. I can do that easy in DB and then I will have the Title on the bmp of stars and I can load that into
my Purebasic program and it will save me time and energy!!
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Deprecation

Post by Demivec »

Hot Pockets wrote:I do think I have that problemed solved. To all thanks fro the help. How ever I still don't know what a deprecated function is? I do beleive I have thought of away to display a Title on my bmp. I can do that easy in DB and then I will have the Title on the bmp of stars and I can load that into my Purebasic program and it will save me time and energy!!
A deprecated function is one that has been replaced or will be discontinued in a future version of PureBasic but still functions in the current version of PureBasic. This means it is advisable to get in the habit of not using it so that when it is done away with completely there won't be problems recompiling the code in later versions.
Hot Pockets
User
User
Posts: 51
Joined: Mon Jun 01, 2009 3:56 am

Deprecation

Post by Hot Pockets »

Thanks Demivec
I guess you might say we'll have deprecated functions as long as We have progress> I understand now!!! :D
Post Reply