Purebasic 3.94 for Mac os x work bad, not properly..........

Mac OSX specific forum
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

I use this code to test someting with images.
With version 5. Oct. 2005 it works (can load picture), no mouseevent on imagegadget.
with the new version i cannot load images and the debugger suddenly crashes, while starting the code with debugger. So I cannot debug this code.

Code: Select all

UseJPEGImageDecoder()
If LoadImage(10,"Bild001.jpg") = 0  ; <######  Change picturepath and name
  MessageRequester("Error","Cannot load picture")  
EndIf                               ; use any picture you want
OpenWindow(0, 0, 0, 250, 250, #PB_Window_SystemMenu|#PB_Window_ScreenCentered, "ImageGadget Event Test") 
CreateGadgetList(WindowID(0)) 
   ResizeImage(10, 100, 100)
   ImageGadget(0, 10, 10, 100, 100, UseImage(10), #PB_Image_Border) 
   ButtonImageGadget(1, 120, 10, 100, 100, UseImage(10))

 Repeat
    Event.l = WaitWindowEvent() 
    If Event = #PB_Event_Gadget 
        If EventGadgetID() = 0   ; ImageGadget
            Select EventType() 
                Case #PB_EventType_LeftClick 
                    Debug "Image Left Click" 
                Case #PB_EventType_RightClick 
                    Debug "Image Right Click" 
                Case #PB_EventType_LeftDoubleClick 
                    Debug "Image Left Double Click" 
                Case #PB_EventType_RightDoubleClick 
                    Debug "Image Right Double Click" 
            EndSelect 
        EndIf
         
        If EventGadgetID() = 1   ; ButtonImageGadget
            Select EventType() 
                Case #PB_EventType_LeftClick 
                    Debug "ImageButton Left Click" 
                Case #PB_EventType_RightClick 
                    Debug "ImageButton Right Click" 
                Case #PB_EventType_LeftDoubleClick 
                    Debug "ImageButton Left Double Click" 
                Case #PB_EventType_RightDoubleClick 
                    Debug "ImageButton Right Double Click" 
            EndSelect 
        EndIf
    EndIf 
 Until Event = #PB_Event_CloseWindow 
Is my code wrong? Compiler-Bug? Linker-Bug? Wrong Library?
I don't know what happens :(
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Load jpg
When I used this code (NOTE THE ABSOLUTE PATH) your code works...
I have not tested any events!

Code: Select all

#Path = "/Users/sveneolsson/Desktop/"
UseJPEGImageDecoder() 
If LoadImage(10,#Path + "02.jpg") = 0
MessageRequester("Error","Cannot load picture")
EndIf
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Debugger
But when I use the debugger, I get an hang.. the debugger never launch.. have to use Force Quit..
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

@SEO
Thanks, with absolute Path it works. On imagegadget I have Leftclick-event and rightclick-event, on ButtonImageGadget i get ONLY a leftclick-event.
But I cannot use the debugger, because the debugger starts and breaks in the same time :(
All debugging only with messagerequester is very long...

I've tested the MacSkeleton too, it looks good :D

michel51
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

@SEO: Thanks for the Mac tips. I am pretty new with Mac and I like it. But I need to find out a lot more.
I reinstalled XCode and I fixed the authorizations on HDD, but it crashes furthermore.
Any other idea?

Best Regards

CSAUER
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

@CSAUER

Witch version of the OS, 10.4.3 ??
I can't say so much more than Repair the permissions and restart your computer ...

And if you get more chrashes tell us wher and in ehat code..
//SEO
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

@CSAUER
try this:
delete the PB-Preference, clean the trash and restart your Mac :!:

michel51
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Where do you find the PB Preferences????
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

Thanks for the hints.
I think I found out where it comes from.
I have got code with 2920 lines. This makes the IDE instable. If I keep loading my source and test all examples, the IDE works without any crash. If I load my source with so many lines, it crashes very often. It doesn't matter, which tab of code you are editing/compiling.

I found out some other problems:
- Calling a function with "Word"/"Byte"/"String"-variable type doesn't work

Following code works fine (returns "30" on debug):

Code: Select all

Procedure.l Maximum(nb1.l, nb2.l)
    If nb1>nb2
      Result = nb1
    Else
      Result = nb2
    EndIf
    ProcedureReturn Result
  EndProcedure 
  
Result = Maximum(15,30)
Debug Result
Following code doesn't work (returns "0" on debug):

Code: Select all

Procedure.w MaximumW(nb1.w, nb2.w)
    If nb1>nb2
      Result = nb1
    Else
      Result = nb2
    EndIf
    ProcedureReturn Result
  EndProcedure 
  
Result = MaximumW(15,30)
Debug Result
String doesn't work as well (return value is "" in debug):

Code: Select all

Procedure.s TestingString(SomeInput.s)
  ProcedureReturn SomeInput.s
EndProcedure

ResultS.s = TestingString("Test")
Debug ResultF.s
Additionally, you have to take care with ProcedureReturns. If Procedure-variable type is "Float", you cannot return an integer value like "0" - you need to return a floating value like "0.0", else you will get a compiler error. Example:

Code: Select all

Procedure.f TestingReturns(SomeInput.f)
  ProcedureReturn 0
EndProcedure

ResultF.f = TestingReturns(21)
Debug ResultF.f
Can you reconstruct my errors?


FYI: I have got Mac OS X 10.4.3 and Purebasic/Mac 3.94b
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

@CSAUER
Your first code works fine

The second returns "0", as you say. I don't know why.

The 3. works. There was a mistake in writing.

Code: Select all

 
 Procedure.s TestingString(SomeInput.s) 
  ProcedureReturn SomeInput
 EndProcedure 

 ResultS.s = TestingString("Test") 
 Debug ResultS
The 4. works too.

Code: Select all

 
 Procedure.f TestingReturns(SomeInput.f)
  Ret.f = SomeInput
  ProcedureReturn Ret
 EndProcedure 

 ResultF.f = TestingReturns(21) 
 Debug ResultF.f
I think, you cannot change the Variable-types. An you have to return a float-value, not an integer :)

Hope, it helps.

michel51
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

SEO wrote:Where do you find the PB Preferences????
I search with find-command from finder. I set the option "visible and hidden" and search "purebasic". Then the .plist were found. Within /user/Library/preferences you can find purebasic.plist too, but with the first option you get all.

michel51
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

With the latest version I get a little other problem. Starting a program via IDE, the application opens "behind" the editor window. The same with the debugger, if it befriends to work :)
How can I change it? I've nothing found in preferences.
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

.plist files
Normally .plist files is not used as Application Preferences....
It have some info for the system like last used folder and so on and is user dependet... (something like that)...
/SEO
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Locking Gadgets
I have an resieable window, and now I am in troubble, I can't find any feature that help me move the buttons and so on when I resize the window. I nedd something like 'button1.LockRight, button1.LockBottom ... Is here something like that?? ... Otherwise... coding,coding,coding....


Debugger
Yes the debugger take focus from the application... And I have an another problem with the debuger after some minutes I have 25 debuggers in the dock ... I have also checked the Preference window...

Regards.
SEO
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

PureBasic doesn't support layouts, so you will have to move the gadgets individually using ResizeGadget(). This command is convenient, as you can use -1 for any parameter to don't change the previous value.

About the debugger, you have to quit it when it ends, as it doesn't close itself.
Post Reply