PureBasic 3.93 Beta 1 for MacOS X out !

Developed or developing a new product in PureBasic? Tell the world about it.
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Post by Doobrey »

Silly question time..
Which Gadget file does this replace ?
the one in purebasic/purelibraries/ or the one in purebasic/subsystems/carbon/purelibraries ?
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

I replaced the purebasic/purelibraries/ one and it works for me now.
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

Couple more things (sorry). Not really a bug, but had me puzzled for quite a while. The code won't compile properly if it has carriage returns instead of line feed at the end of a line (came accross this when trying to use some code from the forum).

Also, this code builds an application, but it 'quits unexpectedly' when it gets focus.

Code: Select all

Structure gauge
  imagegad.l
  imageid.l
  width.l
  height.l
  imagehwnd.l
  precision.l
  ticks.l
EndStructure

NewList led.gauge()

ProcedureDLL LEDgadget(number,x,y,width,height,display)
  AddElement(led())
  SelectElement(led(),number)
  led()\width=width
  led()\height=height
  led()\imageid=CreateImage(#PB_Any,led()\width,led()\height)
  StartDrawing(ImageOutput())
  Box(0,0,led()\width,led()\height,$000000)
  ledheight=led()\height-20
  boxwidth=(led()\width-10-1)/2
  secondx= 6+boxwidth
  tickcount=0
  For a=0 To led()\height-20 Step 4
    tickcount=tickcount+1
    Box(5,a,boxwidth,3,$7F00)
    Box(secondx,a,boxwidth,3,$7F00)
  Next 
  led()\ticks=tickcount
  Locate((led()\width/2)-10,led()\height-15)
  BackColor(0,0,0)
  FrontColor(0, $FF, 0)
  DrawText("0%")
  StopDrawing()
 
led()\imagegad=ImageGadget(#PB_Any,x,y,width,height,UseImage(led()\imageid),#PB_Image_Border)
  ProcedureReturn led()\imagegad
EndProcedure


ProcedureDLL setLEDstate(led,percent)
  SelectElement(led(),led)
  tickcount=led()\ticks
  perc.f=100/led()\ticks
  percents.f=(percent/100)
  finalpercent.f=percents*tickcount
  stringpercent.s=StrF(finalpercent)
  Result.f = Round(finalpercent, 1)
  finalresult=led()\ticks-Result
  ledheight=led()\height-20
  boxwidth=(led()\width-10-1)/2
  secondx=6+boxwidth
  UseImage(led()\imageid)
  StartDrawing(ImageOutput())
  tickcount=0
  For a=0 To led()\height-20 Step 4
    tickcount=tickcount+1
    If tickcount>=finalresult
      Box(5,a,boxwidth,3,$FF00)
      Box(secondx,a,boxwidth,3,$FF00)
    Else
      Box(5,a,boxwidth,3,$7F00)
      Box(secondx,a,boxwidth,3,$7F00)
    EndIf
  Next
  Box(0,led()\height-15,led()\width,15,$000000)
  Locate((led()\width/2)-10,led()\height-15)
  BackColor(0,0,0)
  FrontColor(0, $FF, 0)
  DrawText(Str(percent)+"%")
  StopDrawing()
  SetGadgetState(led()\imagegad,UseImage(led()\imageid))
EndProcedure

#WindowWidth  = 390
#WindowHeight = 350
If OpenWindow(0, 100, 200, #WindowWidth, #WindowHeight, #PB_Window_MinimizeGadget, "")
  If CreateGadgetList(WindowID(0))
  led=LEDgadget(0,50,50,75,200,0)
  EndIf
 
  Repeat
    temp=temp+1
    
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;THIS ONE WORKS
;    temp2=temp%100
;    setLEDstate(0,temp2)
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;THIS ONE DOESNT
     setLEDstate(0,temp%100)
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    EventID = WaitWindowEvent()
   
    If EventID = #PB_EventGadget
     
      Select EventGadgetID()
        Case led
         
      EndSelect
     
    EndIf
   
  Until EventID = #PB_EventCloseWindow

 
EndIf

End
I've put in comments showing which part of the code makes it stop working, but haven't managed to track down the bug any further yet.
BinoX
User
User
Posts: 46
Joined: Mon Jan 31, 2005 11:57 am

Post by BinoX »

Yay ^_^ *Pulls out the Mac again!*
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

For those who have a mac, how is Purebasic ? It sounds like it'll be stable soon, since there's many people here who are improving it !
I hope one day I'll test a mac :)
Fred
Administrator
Administrator
Posts: 18237
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

GreenGiant: thank you, nice report, it's now corrected :) (for the next release).
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

One more for you. This code

Code: Select all

MessageRequester("", "", 0)
Produces an empty messagebox. Whereas this one

Code: Select all

MessageRequester("", a$, 0)
produces nothing. Shouldn't the undeclared variable be initialised when its used? I figure these two should produce the same results.
Fred
Administrator
Administrator
Posts: 18237
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Of course, thanks again for this report, we are on it.
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

I've got no idea whether they're supposed to be working in this beta, but these things don't seem to work for me.

DesktopMouseX()
DesktopMouseY()
WindowMouseX()
WindowMouseY()

and StartDrawing(WindowOutput())

I can give more information about the errors (I think they were linker errors, can check later) if you like, but I wasn't sure whether they were supposed to be functional or not.
akee
Enthusiast
Enthusiast
Posts: 498
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Post by akee »

how does PB for Mac fair on a Mac mini?
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

akee wrote:how does PB for Mac fair on a Mac mini?
That would interest me too...
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

It should be no problem at all, you just need to watch out to make sure you have the minimum OSX version that PB/Mac requires.
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

I have PB working on my 400 MHz G3 based iMac that is running Panther OSX (10.3). It should work like a dream on the mini.
-Beach
Fred
Administrator
Administrator
Posts: 18237
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Yes, PB is working quite quick on my iBook G3 900 mhz, so it should be even faster on a G4 1,24 ghz.
Post Reply