Page 1 of 1

buttyon, no reaction

Posted: Fri Jan 12, 2018 5:34 pm
by t57042

Code: Select all

If OpenWindow(0, 0, 0, 900, 600, "test",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )      
  
  EditorGadget(0,5,5,890,560,#PB_Editor_ReadOnly)         
  StringGadget(1, 15, 530, 790, 30, "") 
  ButtonGadget(2, 810, 530, 77, 30, "Enter")        
EndIf 

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

Repeat 
  Event = WaitWindowEvent() 
  
  Select Event 
    Case #PB_Event_Gadget 
        Select EventGadget() 
            Case 2 
                Debug "hiii" 
        EndSelect       
  EndSelect 

Until Event = #PB_Event_CloseWindow 
End
Why does the button in (simplified) code not react?
I must be overlooking something
thanks
Richard

Re: buttyon, no reaction

Posted: Fri Jan 12, 2018 5:43 pm
by RASHAD
Yes
PB does not support z-order
Your button overlapped the editor gadget

Code: Select all

If OpenWindow(0, 0, 0, 900, 600, "test",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )     
 
  EditorGadget(0,5,5,890,520,#PB_Editor_ReadOnly)         
  StringGadget(1, 15, 530, 790, 30, "")
  ButtonGadget(2, 810, 530, 77, 30, "Enter")       
EndIf

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

Repeat
  Event = WaitWindowEvent()
 
  Select Event
    Case #PB_Event_Gadget
        Select EventGadget()
            Case 2
                Debug "hiii"
        EndSelect       
  EndSelect

Until Event = #PB_Event_CloseWindow
End

Re: buttyon, no reaction

Posted: Fri Jan 12, 2018 5:44 pm
by bbanelli
t57042 wrote:Why does the button in (simplified) code not react?
I must be overlooking something
Because you can't "reach" your button (or string gadget, for that matter).

Change height parameter in EditorGadget() function to 520 or adjust other parameters of other gadgets accordingly and it will work as expected.

Re: buttyon, no reaction

Posted: Fri Jan 12, 2018 6:53 pm
by t57042
thanks guys
Richard

Re: buttyon, no reaction

Posted: Sat Jan 13, 2018 1:04 am
by chi
RASHAD wrote:PB does not support z-order
Who told you that? ;) At least on Windows it work quite well...

But the sort-order is Top to Back! First gadget you create is on top and the following lies underneath (the complete opposite as one might think). So you just have to reverse your gadget order (ID doesn't matter), set the bottom gadget to WS_CLIPSIBLINGS and your are ready to go...

Code: Select all

If OpenWindow(0, 0, 0, 900, 600, "test",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered ) 
  
  ButtonGadget(2, 810, 530, 77, 30, "Enter")       
  StringGadget(1, 15, 530, 790, 30, "")
  EditorGadget(0,5,5,890,560,#PB_Editor_ReadOnly) 
  SetWindowLongPtr_(GadgetID(0), #GWL_STYLE, GetWindowLongPtr_(GadgetID(0), #GWL_STYLE) |#WS_CLIPSIBLINGS)  
      
EndIf

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

Repeat
  Event = WaitWindowEvent()
 
  Select Event
    Case #PB_Event_Gadget
        Select EventGadget()
            Case 2
                Debug "hiii"
        EndSelect       
  EndSelect

Until Event = #PB_Event_CloseWindow
End

Re: buttyon, no reaction

Posted: Sat Jan 13, 2018 1:42 am
by RASHAD
Who told you that? ;)
You are talking trash
I said PB does not support z-order not Windows API
Enlighten me more
Is there any command in PB for getting parent or ancestor of any object?
NO
Once more
PB does not support z-order
Why everybody in the forum all of the sudden became a lecturer teaching the others?

Re: buttyon, no reaction

Posted: Sat Jan 13, 2018 2:54 am
by chi
my bad :)

Re: buttyon, no reaction

Posted: Sat Jan 13, 2018 9:19 am
by nco2k
technically you could use UseGadgetList(GadgetID(0)) and add the other gadgets as children of the EditorGadget(). but its not a very good solution tbh. you could also use SetWindowPos_() with #HWND_TOP/BOTTOM etc. to change the z-order. but the best solution would be of course to not have any overlapping gadgets at all.

c ya,
nco2k

Re: buttyon, no reaction

Posted: Sat Jan 13, 2018 1:01 pm
by Wolfram
I think is not a basic PB problem.
On OSX this code works.

Re: buttyon, no reaction

Posted: Sat Jan 13, 2018 3:31 pm
by nco2k
@Wolfram
iirc, gtk has/had problems with the z-order, so the team decided to not implement a z-order system at all.

c ya,
nco2k