Simple App Not Working

Mac OSX specific forum
ColBoy
Enthusiast
Enthusiast
Posts: 143
Joined: Fri Feb 13, 2004 2:37 pm
Location: Ottawa, Canada
Contact:

Simple App Not Working

Post by ColBoy »

Well I've finally bitten the bullet and started using Purebasic in earnest after having been a registered user for over a year. Anyway I've decided to start with a nice simple app, and thought I'd kill two birds with one stone and try out the Mac version on my new Mac Mini. Anyway here's where I'm at.

I have a nice simple program, that has an ExplorerList and ExplorerTree gadget and also a ListView gadget. I fleshed out the UI using PureVision on the PC and ported the code across. The code for the UI is as follows.

pipl_constants.pb

Code: Select all

Global BubbleTipStyle.l:BubbleTipStyle=0

;-Window Constants
Enumeration 1
  #Window_Form1
EndEnumeration
#WindowIndex=#PB_Compiler_EnumerationValue


;-Gadget Constants
Enumeration 1
  ;Window_Form1
	#Gadget_Form1_lstDirectory
  #Gadget_Form1_lstFiles
  #Gadget_Form1_lstPlaylist
  #Gadget_Form1_Container5
  #Gadget_Form1_Area6
EndEnumeration
#GadgetIndex=#PB_Compiler_EnumerationValue

pipl_windows.pb

Code: Select all

XIncludeFile "pipl_Constants.pb"


Procedure.l Window_Form1()
  If OpenWindow(#Window_Form1,154,236,611,449,#PB_Window_SystemMenu|#PB_Window_TitleBar|#PB_Window_ScreenCentered|#PB_Window_Invisible,"Work Form1")
    If CreateGadgetList(WindowID(#Window_Form1))
      ExplorerTreeGadget(#Gadget_Form1_lstDirectory,10,5,200,385,"/",#PB_Explorer_NoFiles)
      ExplorerListGadget(#Gadget_Form1_lstFiles,220,5,385,185,"/",#PB_Explorer_NoFolders|#PB_Explorer_NoParentFolder|#PB_Explorer_NoMyDocuments)
      ListViewGadget(#Gadget_Form1_lstPlaylist,220,200,385,190)
      ContainerGadget(#Gadget_Form1_Container5,10,400,595,30)
      CloseGadgetList()
      HideWindow(#Window_Form1,0)
      ProcedureReturn WindowID()
    EndIf
  EndIf
EndProcedure
and finally

pipl.pb

Code: Select all

XIncludeFile "pipl_Constants.pb"
XIncludeFile "pipl_Windows.pb"


;Procedure WindowCallback(WindowID,Message,wParam,lParam)
;	ReturnValue=#PB_ProcessPureBasicEvents
;
;	ProcedureReturn ReturnValue
;EndProcedure


;-Main Loop
If Window_Form1()
	;SetWindowCallback(@WindowCallback())

  	quitForm1=0
  	Repeat
   	EventID=WaitWindowEvent()
    	Select EventID
      	Case #PB_Event_CloseWindow
        		If EventWindowID()=#Window_Form1
          		quitForm1=1
        		EndIf
      	Case #PB_Event_Gadget
        		Select EventGadgetID()
          		Case #Gadget_Form1_lstDirectory
		          	Result.s=GetGadgetText(#Gadget_Form1_lstDirectory)
	          		Debug result
						    SetGadgetText(#Gadget_Form1_lstFiles,result)
          		Case #Gadget_Form1_lstFiles
          		Case #Gadget_Form1_lstPlaylist
            		Select EventType()
              			Case #PB_EventType_LeftDoubleClick
              			Default
            		EndSelect
         		Case #Gadget_Form1_Area6
				EndSelect
    		EndSelect
  	Until quitForm1
  	CloseWindow(#Window_Form1)
EndIf

End
Firstly, just a note to Fred, the copy, cut and paste shortcuts do not work. Also I cannot insert a newline without pressing Shift+Return.

Anyway back to my example, which works fine under windows. The basic functionality navigates directories using the ExplorerTree and depending on which directory I select, the files in that directory appear in the ExplorerList.

If I select /Volumes as the starting folder, I can click on the /DATADRIVE which is my removable drive, but I cannot open the drive. If I select the starting directory as / then I can navigate to Volumes and then DATADRIVE, but all the files appear in the ExplorerTree and not the ExplorerList, even though I've selected not to display files in the ExplorerTree.

Also I've commented out the WindowCallBack procedure as it complained about an undefined Constant, is this required under the Mac?

Anyway pardon my lame questions, but we all have to start somewhere. As I said before the basic functionality works fine under Windows.

Many thanks

Colin
Last edited by ColBoy on Wed Aug 10, 2005 7:38 pm, edited 1 time in total.
ColBoy
Enthusiast
Enthusiast
Posts: 143
Joined: Fri Feb 13, 2004 2:37 pm
Location: Ottawa, Canada
Contact:

Post by ColBoy »

Can anyone shed some light on this? Fred?
Colin
pantsonhead
User
User
Posts: 39
Joined: Fri Mar 26, 2004 1:47 pm
Location: London, UK
Contact:

definitely some bits not working right

Post by pantsonhead »

Hi ColBoy

I had no problems with accessing a removable drive, I was able to browse the folders on my USB Flashdrive as easily as my HDD.

There's definitely some unfinished functionality on the ExplorerTreeGadget and ExplorerListGadget.
They both seem to ignore the Flags passed in your code (haven't checked them all) as files are still visible in the Tree and folders and visible in the List.

The ExplorerListGadget didn't seem to accept the new path via SetGadgetText either (did you get that too?)

I would guess these are still on Fred's OSX ToDo List (or will be soon ;-) )

PS: I'm testing this in OSX beta6 on 10.3.9 on an old Bronze powerbook.
Fred
Administrator
Administrator
Posts: 16690
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Sorry for the delay about this one, but i was reading again all the OS X posts. It's now fixed for the next release.
Post Reply