Resize bug

Post bugreports for the Linux version here
User avatar
Erlend
Enthusiast
Enthusiast
Posts: 114
Joined: Mon Apr 19, 2004 8:22 pm
Location: NORWAY

Resize bug

Post by Erlend »

Hello all

although this is not confirmed it is probably a bug in resizing in gtk3

Test this code with gtk2 sublibrary first to se expected behaviour.
Then with gtk3, now you will see what I mean with resize bug, please check behaviour on scrollbars :shock: .

Code: Select all

Structure VView
  id.i        ;container id
  canvas_id.i ;canvas id
  vert_id.i   ;v scroller id
  horz_id.i   ;h scroller id
  x.i         ;gadget x
  y.i         ;gadget y
  w.i         ;gadget width
  h.i         ;gadget height
  vc.i        ;canvas of view
  ;
  callback.i ; user callback
  vw.i       ; virtual width
  vh.i       ; virtual height
EndStructure

Procedure.i ViewGadgetCallback()
  evtype=EventType()
  gadget=EventGadget()
  If IsGadget(gadget)
    *VV.VView=GetGadgetData(gadget) 
    out.s=""
    Select gadget
        Case *VV\id
          *VV\x=GadgetX(*VV\id)
          *VV\y=GadgetY(*VV\id)
          *VV\w=GadgetWidth(*VV\id)
          *VV\h=GadgetHeight(*VV\id)
          
          out+Str(*VV\x)+" "+Str(*VV\y)+" "+Str(*VV\w)+" "+Str(*VV\h)
          StartDrawing(CanvasOutput(*VV\canvas_id))
            DrawText(10,10,out)
          StopDrawing()
          
          ResizeGadget(*VV\horz_id,0,*VV\h-15,*VV\w-15,15)
          ResizeGadget(*VV\vert_id,*VV\w-15,0,15,*VV\h)
          ResizeGadget(*VV\canvas_id,0,0,*VV\w-15,*VV\h-15)          
    EndSelect     
  EndIf
EndProcedure

Procedure ViewGadget(id,x,y,width,height,virtual_width,virtual_height,callback)
  *VV.VView=AllocateMemory(SizeOf(VView))
  If id=#PB_Any
    *VV\id=ContainerGadget(id,x,y,width,height)
    result=*VV\id
  Else
    ContainerGadget(id,x,y,width,height)
    *VV\id=id : result=GadgetID(id)
  EndIf
  If virtual_width=<width:virtual_width=width:EndIf
  If virtual_height=<height:virtual_height=height:EndIf
  *VV\canvas_id=CanvasGadget(#PB_Any,0,0,width,height)
  SetGadgetData(*VV\canvas_id,*VV)
  *VV\horz_id=ScrollBarGadget(#PB_Any,0,height-15,width-15,15,0,virtual_width,width)
  SetGadgetData(*VV\horz_id,*VV)
  *VV\vert_id=ScrollBarGadget(#PB_Any,width-15,0,15,height,0,virtual_height,height,#PB_ScrollBar_Vertical)
  SetGadgetData(*VV\vert_id,*VV)
  If virtual_width=<width : HideGadget(*VV\horz_id,#True) : EndIf
  If virtual_height=<height : HideGadget(*VV\vert_id,#True) : EndIf
  CloseGadgetList()
  SetGadgetData(*VV\id,*VV)
  BindGadgetEvent(*VV\id,@ViewGadgetCallback(),#PB_EventType_Resize)
  ProcedureReturn result
EndProcedure

; test code
OpenWindow(0,0,0,600,400,"")
gad=ViewGadget(#PB_Any,0,0,390,390,500,500,0)
ButtonGadget(10,500,5,100,30,"Test")
SplitterGadget(20,0,0,400,390,gad,10)

Repeat
  event=WaitWindowEvent()
  If event=#PB_Event_Gadget
    If EventGadget()=10
      ResizeGadget(20,0,0,500,400)
    EndIf
  EndIf
Until event=#PB_Event_CloseWindow


BR
Erlend
User avatar
Mijikai
Addict
Addict
Posts: 1517
Joined: Sun Sep 11, 2016 2:17 pm

Re: Resize bug

Post by Mijikai »

Can confirm.
The ScrollBars multiplied and the active ones switched sides (but switch back when dragged). :shock:
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Resize bug

Post by Fred »

This one is weird and I got no clue why it does that, may be someone have some idea how properly move the widget
Post Reply