Known Limits in PB 3.94 Mac

Mac OSX specific forum
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Just another crazy example

Here is another example with 3 windows, just open the windows and check the result in the debugger...

http://www.xhtmlsoft.com/pb/downloads/W ... st3.pb.zip

This was the last test i do to get this to work, I can't spend more time on this (sorry)... waiting on next release of PB for Mac

Regards,
SEO
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

This example is realy crazy :!:

When I open all the windows, it seems, that the "last opened"-WindowID is fixed.
I can activate whichever window I want, the result in debuuger allways is the same: it shows the WindowID of the last opened window. So the windowactivateevent cannot work and also the closewidget works not correct, because it's not unique to its own window.

That looks like a bug!

Michel51
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

SEO wrote:IDE BUG

This pictures shown some minor bugs in the ide.
This bugs is created when I resize an window.
Perhaps it could be fixed using 'Live Resize' and the window set to 'Composite'.

http://www.xhtmlsoft.com/pb/images/idebug1.png
http://www.xhtmlsoft.com/pb/images/idebug2.png

//SEO

PS. I think Mac OS X have more posts than Amiga OS :!:
Report in the Bug Reports forum.

SEO wrote:Menu Problem
I have done an new example on the menu problems. One main window and one Tool window with the same menu created. This example shows better that the menu is not changed when I open the Tool window. BUT when I close the Tool Window, then the Tool Windows menu is used!! And then the Menu not work, because the menu not exists...
http://www.xhtmlsoft.com/pb/downloads/MenuTest.zip
//SEO
The code does not run because of three missing constants. This means that this code was changed after the last time you ran it. If you need to demonstrate a bug, post code which you know compiles (unless that's the bug of course). Also it's a very messy very large code, so it's difficult to spot the problem. Remove absolutely EVERYTHING that can be removed while still keeping the problem, and if not obvious, point out what you can't remove without stopping the problem from occuring.
SEO wrote:Acivate Window Event
It looks that the Activate Event NOT fire ....
//SEO
Again, you supply a very large messy code, much of which is unrelated to problem, which doesn't compile because of some missing constants. Reduce it but not so much it doesn't compile.
SEO wrote:Just another crazy example
Here is another example with 3 windows, just open the windows and check the result in the debugger...
http://www.xhtmlsoft.com/pb/downloads/W ... st3.pb.zip
This was the last test i do to get this to work, I can't spend more time on this (sorry)... waiting on next release of PB for Mac
Regards,
SEO
If does not look weird to me, what did you want it do?
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

The code does not run because of three missing constants. This means that this code was changed after the last time you ran it. If you need to demonstrate a bug, post code which you know compiles (unless that's the bug of course). Also it's a very messy very large code, so it's difficult to spot the problem. Remove absolutely EVERYTHING that can be removed while still keeping the problem, and if not obvious, point out what you can't remove without stopping the problem from occuring.
Could you tell me what Constants are missing?
Again, you supply a very large messy code, much of which is unrelated to problem, which doesn't compile because of some missing constants. Reduce it but not so much it doesn't compile.
Could you tell me what Constants are missing?
If does not look weird to me, what did you want it do?
Only normal behaiviors that you expect to do with 3 windows, Open, Close and fire the #PB_Event_ActivateWindow..

//END!
User avatar
michel51
Enthusiast
Enthusiast
Posts: 290
Joined: Mon Nov 21, 2005 10:21 pm
Location: Germany

Post by michel51 »

@Trond
If does not look weird to me, what did you want it do?
SEO means, that activating a window and #PB_Event_ActivateWindow are not working in a correct manner. If you run 'windowtest3.pb' (on Mac!!) and you open all the windows via menu, then you can move the windows, the event works (shown in debugger) and you have 3 windows an screen. Now select one and you will see, that the windowID and other vars are NOT changed. On screen you will see, that the 'clicked' window has the focus, but you cannot interrogate, WHICH window is activated, because the WindowID is the same as the window, that is opened at last.
I've tested it in different ways and also opened the windows not in series. The result was allways the same: only the ID of the last opened window is available.
Perhaps it's a problem on mac, or a bug. Hope, that Fred read this :)

Regards
michel51
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.21(x64), V 5.22beta
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

michel51 wrote:@Trond
If does not look weird to me, what did you want it do?
SEO means, that activating a window and #PB_Event_ActivateWindow are not working in a correct manner. If you run 'windowtest3.pb' (on Mac!!) and you open all the windows via menu, then you can move the windows, the event works (shown in debugger) and you have 3 windows an screen. Now select one and you will see, that the windowID and other vars are NOT changed. On screen you will see, that the 'clicked' window has the focus, but you cannot interrogate, WHICH window is activated, because the WindowID is the same as the window, that is opened at last.
I've tested it in different ways and also opened the windows not in series. The result was allways the same: only the ID of the last opened window is available.
Perhaps it's a problem on mac, or a bug. Hope, that Fred read this :)

Regards
michel51
Yes, I see it does that, but that's what the code says it should do. EventWindowID() is there for a reason. And the other windows doesn't receive events until the last opened window is closed because of the event loop.
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Yes, I see it does that, but that's what the code says it should do. EventWindowID() is there for a reason. And the other windows doesn't receive events until the last opened window is closed because of the event loop.
Are you meaning that I can't create an simple Mac app with 2 or 3 windows or is there any other code to use??
/SEO
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

ah, seo, wrong :-)

of course you can, at least, i assume, do not have a max here, but here's the concept (pseudocode):

Code: Select all

openwindow 1
openwindow 2
openwindow 3

repeat
  event = waitwindowevent()
  event_window = eventwindowid()
  event_type = eventtype()
  event_gadget = eventgadgetid()
  ;
  select event_window
  case window1
    ...
  case window2
    ...
  case window3
    ...
  endselect
until event = ...
a little on that is here...

http://www.xs4all.nl/~bluez/datatalk/pure4.htm#4_events

but that's still a work under construction...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Henrik
Enthusiast
Enthusiast
Posts: 404
Joined: Sat Apr 26, 2003 5:08 pm
Location: Denmark

Post by Henrik »

HI
Right: I don't understand the problem fully, i'don't have a Mac.
I can see from your other post (pictures) that ther is something weird goging on.

Looking at your source and what i understand of the problem, you should:

1 Omly have a eventloop in the main source, using EventWindowID() to determine on which window the event has occured.
Look in help for "EventWindowID()"

2 do not use the same constants for all the windows, not that you can't but it gets messy to read for your self too.

and Pls. make sure that the source you post can run without been edit first, it can't now coz

#PB_Menu_About, #PB_Menu_Preferences and #PB_Menu_Quit is not set to anything.

remove menuitems if they are not part of the problem.

but i don't have a mac so i can't help you..

Best Regrads Henrik.
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Thanks 'blueznl' thats constructive!
I should test it out...

Henrik: Thanks!
1 - OK I understand, should I detect all events, also buttons and so on

#PB_Menu_About .... ... .. Are valid PB Constants for the Application Menu and works on OS X

'Nu e de tid før en Sort Guld!'

//SEO
Henrik
Enthusiast
Enthusiast
Posts: 404
Joined: Sat Apr 26, 2003 5:08 pm
Location: Denmark

Post by Henrik »

He he Okay SEO :D
I didn't know that, i don't know anything about Mac at all :oops:

uhm About the Beer thing. No more beer to me, hate watching movies with a hand in front one eye :shock:

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

Post by SEO »

Mac Window Test 001

Now it begin to like something!
But I have an Question about the menu code. It looks like I have to detect the menu items in every ' Case Main_Window, Case #Wnd1 Case #Wnd2 .... and so on ... So if I have 255 menuitems and 60 windows = 15300 lines to get the menu to work!! Is this correct??

http://www.xhtmlsoft.com/pb/downloads/MacWndTest.pb.zip

Any ideas about this?
Thx,
SEO
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Mac Window Test 002
My Test fails again!

If I open Window 1, Window2, Window3 and then Close Window3 Then I can't open window3 again from the menu
http://www.xhtmlsoft.com/pb/downloads/M ... st-002.zip

Any ideas how to solve this problem?
Regards,
SEO
Henrik
Enthusiast
Enthusiast
Posts: 404
Joined: Sat Apr 26, 2003 5:08 pm
Location: Denmark

Post by Henrik »

Hi
Again tested on windows..

Every time your you creat a new window you creat a menu with the same ID/number

If CreateMenu(0<- ; ,WindowID())
this means that the previous menu is destroyed and a new "Menu 0" is created by CreateMenu(0.

And Btw. i never seen include used like this, "in my book this shoulden work but it does",
every time a a windowevent happen you include the file "EventMenus.incl"
It seems wrong ot me.
from the help file :
IncludeFile will include any named source file, at the current place in the code.


Anyway this workes on window

MacWndTest\MacWndTest.pb

Code: Select all

;
; Mac Window Test Application Version 0.0.2 / 2005-12-26
;
;
;
;
;

Global myAppName$
myAppName$  = "MacWndTest"



#Main_Window = 0
#Wnd1_Window = 1
#Wnd2_Window = 2
#Wnd3_Window = 3

; for windows users uncomment the following
; #PB_Menu_About=7
; #PB_Menu_Preferences=8
; #PB_Menu_Quit=9

Procedure Main_Menu(Menu_ID)  ;<-  ** Change **
If CreateMenu(Menu_ID,WindowID()) ;<-  ** Change **
 MenuTitle("Window")
 MenuItem(1, "Window 1")
  MenuItem(2, "Window 2")
   MenuItem(3, "Window 3")
   
   
;------------------------------------------------------------------
 MenuItem(#PB_Menu_About, "About " + myAppName$ +Chr(9) + "CMD+A")
 MenuItem(#PB_Menu_Preferences, "Preferences" +Chr(9) + "CMD +,")
MenuItem(#PB_Menu_Quit, "Quit" + Chr(9) +"CMD+Q")
EndIf
EndProcedure






Procedure Window1_show()
If OpenWindow(#Wnd1_Window, 60,60,290, 215,  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget, "Window 1")
Main_menu(1) ;<-  ** Change **
EndIf
EndProcedure



Procedure Window2_show()
If OpenWindow(#Wnd2_Window, 60,90,290, 215, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget, "Window 2")
Main_menu(2) ;<-  ** Change **
EndIf
EndProcedure


Procedure Window3_show()
If OpenWindow(#Wnd3_Window, 60,120,290, 215, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget, "Window 3")
Main_Menu(3) ;<-  ** Change **
EndIf
EndProcedure






;====================================================================================================================================


If OpenWindow(#Main_Window, 100,200,290, 215, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget, "Window 0")
Main_menu(0)  ;<-  ** Change **

Repeat
  Main_EventID = WaitWindowEvent()
  Event_WindowID = EventWindowID()
  Event_TypeID = EventType()
  Event_GadgetID = EventGadgetID()
    
  Select Event_WindowID
 
  
;------------------------------------------------------------------------------------------------------------------------------------  
  Case #Main_Window
   Select Main_EventID
   Case #PB_Event_CloseWindow : Quit = 1
   IncludeFile "EventMenus.incl"
   EndSelect; Main_Event 
;------------------------------------------------------------------------------------------------------------------------------------  
  
  Case #Wnd1_Window
  Select Main_EventID
   Case #PB_Event_CloseWindow : CloseWindow(#Wnd1_Window)
   IncludeFile "EventMenus.incl"
   EndSelect ; Main_EventID
;------------------------------------------------------------------------------------------------------------------------------------  
  Case #Wnd2_Window
  Select Main_EventID
   Case #PB_Event_CloseWindow : CloseWindow(#Wnd2_Window)

  
   IncludeFile "EventMenus.incl"
   EndSelect ;Main_EventID
;------------------------------------------------------------------------------------------------------------------------------------
    
  Case #Wnd3_Window
  Select Main_EventID
   Case #PB_Event_CloseWindow : CloseWindow(#Wnd3_Window)
   IncludeFile "EventMenus.incl"
   EndSelect ;Main_EventID
;------------------------------------------------------------------------------------------------------------------------------------
 
  
  
  
EndSelect ; Event_WindowID

Until Quit = 1
End ; Terminate Application
EndIf ; OpenWindow(Main_Window) 

MacWndTest\EventMenus.incl

Code: Select all


Case #PB_Event_Menu
  Main_MenuItem = EventMenuID()
  Select Main_MenuItem
  Case 1 : Window1_Show()
  Case 2 : Window2_Show()
  Case 3 : Window3_Show()
  Case #PB_Menu_Quit : Quit = 1
  EndSelect ; Main_MenuItem
Best Henrik
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Hi Henrik!
Thanks for your try...

But it not works for me.
I Open Window1, window2, window3 and then close window3.
Then i try to open window3 again, but Nope not working.

I have also used the Activate Event like this
Case #PB_Event_ActivateWindow : Main_menu(1)

Code: Select all

Case #Wnd1_Window
  Select Main_EventID
   Case #PB_Event_CloseWindow : CloseWindow(#Wnd1_Window)
   Case #PB_Event_ActivateWindow : Main_menu(1)
   IncludeFile "EventMenus.incl"
   EndSelect ; Main_EventID
But it not looks that the ActivateWindow Event is fired..

IncludeFile: I hope that is an Compiler Directive and only used to include the code when compiling the code...

//SEO
Post Reply