Page 2 of 2

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 3:41 pm
by GJ-68
I don't understand your problem with initial sizing.
This works for me.

Code: Select all

OpenWindow(1, 0, 0, 220, 100, "PB 5.30 b2", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_Invisible)
ListViewGadget(1, 0, 0, 0, 0) ; <- No position and no size here
HideWindow(1,0) ; <- #PB_Event_SizeWindow fired here
    
Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_SizeWindow
      ResizeGadget(1,10,10,WindowWidth(1)-20,WindowHeight(1)-20)
  EndSelect
Until Event = #PB_Event_CloseWindow

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 3:45 pm
by DK_PETER
@Grabiller

Normally, I don't get into debates like this. 'Acting up' because something doesn't suit you - is totally bad form.
I, for one - have absolutely no problem with the current implementation.

My main concern here is: Only a minority of registred users visits this forum and a tiny portion of those engage actively
in debates. Still some people act out an illusion of grandure - believing, that speak for us all.
State your case and don't ever assume, that you have the majority to back you up.

@Team.
Keep on doing, what you're doing. You work and dedication are truly appreciated.
In this regard, I believe, that I speak for all. ;-)

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 3:48 pm
by grabiller
GJ-68 wrote:I don't understand your problem with initial sizing.
This works for me.

Code: Select all

OpenWindow(1, 0, 0, 220, 100, "PB 5.30 b2", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_Invisible)
ListViewGadget(1, 0, 0, 0, 0) ; <- No position and no size here
HideWindow(1,0) ; <- #PB_Event_SizeWindow fired here
    
Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_SizeWindow
      ResizeGadget(1,10,10,WindowWidth(1)-20,WindowHeight(1)-20)
  EndSelect
Until Event = #PB_Event_CloseWindow
Well, yes, you certainly have a point here, we can use this workaround, indeed.

Thanks for pointing it out.

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 3:52 pm
by Danilo
grabiller wrote:So what the point removing this event at all in the first place ? What is the benefit ?
Behavior was not cross-platform, so there were 2 choices:
1.) Remove the event on Windows
2.) Add the event to Linux and Mac

They decided to remove it on Windows, so behavior is cross-platform now.

If they would have added it to Linux and Mac, the Linux and Mac
guys could complain that there is now an additional event that is
usually not correct on their platform. Same as you complain now that
it is not correct Windows behavior. ;)

Personally, I just want it 100% cross-platform, because that's what PB is.
Whether they choose way (1) or (2), it should be same on all platforms.

If they add the event on all platforms and you open an invisible Window,
should the resize event fire?
Or should it be fired on first HideWindow(x,0) call, when the window appears
on screen for the first time ("resize from nothing to initial size")?
This could also be a candidate for another event, like OnCreate/OnAfterCreate/OnShowWindow...

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 3:55 pm
by Danilo
GJ-68 wrote:I don't understand your problem with initial sizing.
This works for me.

Code: Select all

OpenWindow(1, 0, 0, 220, 100, "PB 5.30 b2", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_Invisible)
ListViewGadget(1, 0, 0, 0, 0) ; <- No position and no size here
HideWindow(1,0) ; <- #PB_Event_SizeWindow fired here
    
Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_SizeWindow
      ResizeGadget(1,10,10,WindowWidth(1)-20,WindowHeight(1)-20)
  EndSelect
Until Event = #PB_Event_CloseWindow
HideWindow() does not fire #PB_Event_SizeWindow cross-platform. Your way does not work on Mac OS X (can't see the ListViewGadget).
It is exactly the problem that needs to get addressed for a cross-platform system.

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 3:57 pm
by freak
> You are in control of the PureBasic language, so what prevent you to internally rewire the real-time sizing binded event as a PureBasic window event/message ?

I explained exactly that point in my post. Maybe you should read it before mouthing off.

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 4:00 pm
by grabiller
DK_PETER wrote:@Grabiller
Normally, I don't get into debates like this. 'Acting up' because something doesn't suit you - is totally bad form.
I, for one - have absolutely no problem with the current implementation.
Good for you.
DK_PETER wrote:My main concern here is: Only a minority of registred users visits this forum and a tiny portion of those engage actively
in debates. Still some people act out an illusion of grandure - believing, that speak for us all.
State your case and don't ever assume, that you have the majority to back you up.
I stated 'my' case because the issue came from one (or few peoples) who convinced Fred to change PB behavior regarding sizing events. I think the illusion of 'grandure' did not came from me on this point.

I'm just acting as a counter-illusion here, and I'm not the only one who think it was a stupid decision inferred by one or a few users.

So next time you feel entitled to give your judgment about someone intervention, try to do it toward the source of the issue, unless you felt it was a great decision and you now feel reversing that decision does not suit you anymore ?

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 4:04 pm
by grabiller
freak wrote:> You are in control of the PureBasic language, so what prevent you to internally rewire the real-time sizing binded event as a PureBasic window event/message ?
I explained exactly that point in my post. Maybe you should read it before mouthing off.
No, you just want to have the last word and not have a constructive discussion.
You don't like my attitude ? Fine, I don't like yours. What next ?

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 4:15 pm
by grabiller
Danilo wrote:
grabiller wrote:So what the point removing this event at all in the first place ? What is the benefit ?
Behavior was not cross-platform, so there were 2 choices:
1.) Remove the event on Windows
2.) Add the event to Linux and Mac
They decided to remove it on Windows, so behavior is cross-platform now.
If they would have added it to Linux and Mac, the Linux and Mac
guys could complain that there is now an additional event that is
usually not correct on their platform. Same as you complain now that
it is not correct Windows behavior. ;)
Well, I understand yes.
Danilo wrote:Personally, I just want it 100% cross-platform, because that's what PB is.
Whether they choose way (1) or (2), it should be same on all platforms.
Fair enough, indeed. I certainly agree about cross-platform consistency.
Danilo wrote:If they add the event on all platforms and you open an invisible Window,
should the resize event fire?
I think it should, yes, because what makes a Window at first, showed or not, is its topology. There are circumstances where a Window may ultimately have a different topology that the one you give to OpenWindow (maximized window for instance, and this may be not hardcoded when you create a window, depending on your application). So it is very elegant to have this first sizing event triggered, as then you can shape your window content accordingly without the need to worry about if it is the first or the next sizing event.

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 4:32 pm
by Danilo
grabiller wrote:
Danilo wrote:If they add the event on all platforms and you open an invisible Window,
should the resize event fire?
I think it should, yes, because what makes a Window at first, showed or not, is its topology. There are circumstances where a Window may ultimately have a different topology that the one you give to OpenWindow (maximized window for instance, and this may be not hardcoded when you create a window, depending on your application). So it is very elegant to have this first sizing event triggered, as then you can shape your window content accordingly without the need to worry about if it is the first or the next sizing event.
Let's emulate it by adding a PostEvent() right after OpenWindow():

Code: Select all

Procedure Win1_Resize()
    Debug "Win1_Resize()"
    ResizeGadget(1,10,10,WindowWidth(1)-20,WindowHeight(1)-20)
    ;If IsGadget(1) : ResizeGadget(1,10,10,WindowWidth(1)-20,WindowHeight(1)-20) : EndIf
EndProcedure


; When binding #PB_Event_SizeWindow before the window
; is created, the event arrives.
; But at this point, the gadgets are not created,
; so everything must be checked with IsGadget()
; inside the resize procedure.
; Gadgets that are not created yet can't get resized.
;
BindEvent(#PB_Event_SizeWindow,@Win1_Resize(),1)

If OpenWindow(1, 0, 0, 220, 100, "Win1",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_Invisible):PostEvent(#PB_Event_SizeWindow,1,0)
    
    ; When binding #PB_Event_SizeWindow after the window
    ; is created, the old event does not arrive at this
    ; new event procedure
    BindEvent(#PB_Event_SizeWindow,@Win1_Resize(),1)
    
    ListViewGadget(1,10,10,WindowWidth(1)-20,WindowHeight(1)-20)
    For i = 1 To 100:AddGadgetItem(1,-1,"ListViewGadget Line "+i):Next
    
    HideWindow(1,0)
    ;Win1_Resize() ; you can call resize anytime manually
    ;PostEvent(#PB_Event_SizeWindow,1,0)
    
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
So #PB_Event_SizeWindow at window creation is quite useless, because there
are no gadgets yet, that can be resized.
Looks like you need the resize event on HideWindow(1,0), which is not the
case on MacOSX at this time.

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 4:46 pm
by grabiller
Danilo wrote:../.. So #PB_Event_SizeWindow at window creation is quite useless, because there
are no gadgets yet, that can be resized.
Looks like you need the resize event on HideWindow(1,0), which is not the
case on MacOSX at this time.
Well, the patch I use (http://www.purebasic.fr/english/viewtop ... 56#p445956) is working as expected, but this is on an OpenGL window.

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 5:02 pm
by freak
Well ok then. I give up. I tried to explain in detail why the change was done. I even answered your exact question: No, we cannot "internally rewire the real-time sizing binded event" without reverse-engineering part of the OS. Read my post if you want to know the details.

Anyway, since you are obviously just trolling at this point, I am not going to discuss this further with you. Have a nice day.

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 5:04 pm
by HeX0R
freak wrote:[...]They are sometimes also called from functions that change the GUI (if this change directly generates an event).
O.k., than maybe this effect is my problem.
Would you mind listing the functions, which are doing this?

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 5:06 pm
by Danilo
grabiller wrote:Well, the patch I use (http://www.purebasic.fr/english/viewtop ... 56#p445956) is working as expected
Your patch gives you back the old behavior on Windows only.

Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu

Posted: Sat Jun 07, 2014 7:42 pm
by Fred
@Grabiller: please watch your tone here, I'm all for arguing, but you are somewhat out of the line, especially when Freak spend the time to explain in detail how Windows actually works. We do decisions we think are the best. You (obvioulsy) don't know the PB internals so you have to trust us when we do changes, we don't do it for fun. After further thoughs, having a "resize" event (as it's documented here: http://www.purebasic.com/documentation/ ... event.html) when opening a window is just silly and was an inconsistency, so it will stray as it is now. You assumed it was the same than #WM_SIZE, you were wrong. Now use a real callback if you want to have Windows specific stuffs and get over it. I lock this subject.