PureBasic Forum
https://www.purebasic.fr/english/

SplitterGadget bug
https://www.purebasic.fr/english/viewtopic.php?f=22&t=68472
Page 1 of 1

Author:  DarkDragon [ Sun May 14, 2017 12:07 pm ]
Post subject:  SplitterGadget bug

Hello,

System: Arch Linux (64 bit), GNOME 3.22.3
Situation: Two nested splittergadgets created with the form designer
Problem: form designer doesn't show hierarchy correctly and after switching to source code and back it is completely messed up. Also the anchoring is messed up and scaling up the window leads to a even higher scale of the splittergadget.

FormMain.pbf:
Code:
;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;

Global WindowMain

Global PanelToolbox, TreeObjects, SplitterHorizontal, CanvasDesign, SplitterVertical

Enumeration FormMenu
  #MenuItemNew
  #MenuItemOpen
  #MenuItemSave
  #MenuItemSaveAs
EndEnumeration

Declare ResizeGadgetsWindowMain()


Procedure OpenWindowMain(x = 0, y = 0, width = 800, height = 580)
  WindowMain = OpenWindow(#PB_Any, x, y, width, height, "Designer", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar)
  CreateMenu(0, WindowID(WindowMain))
  MenuTitle("File")
  MenuItem(#MenuItemNew, "New")
  MenuItem(#MenuItemOpen, "Open ...")
  MenuItem(#MenuItemSave, "Save")
  MenuItem(#MenuItemSaveAs, "SaveAs")
  PanelToolbox = PanelGadget(#PB_Any, 10, 10, 260, 260)
  AddGadgetItem(PanelToolbox, -1, "Tab 1")
  CloseGadgetList()
  TreeObjects = TreeGadget(#PB_Any, 10, 279, 260, 251)
  SplitterHorizontal = SplitterGadget(#PB_Any, 10, 10, 260, 520, PanelToolbox, TreeObjects)
  SetGadgetState(SplitterHorizontal, 260)
  CanvasDesign = CanvasGadget(#PB_Any, 279, 10, 511, 520, #PB_Canvas_Border | #PB_Canvas_Keyboard)
  SplitterVertical = SplitterGadget(#PB_Any, 10, 10, 780, 520, SplitterHorizontal, CanvasDesign, #PB_Splitter_Vertical)
  SetGadgetState(SplitterVertical, 260)
EndProcedure

Procedure ResizeGadgetsWindowMain()
  Protected FormWindowWidth, FormWindowHeight
  FormWindowWidth = WindowWidth(WindowMain)
  FormWindowHeight = WindowHeight(WindowMain)
  ResizeGadget(PanelToolbox, 10, 10, FormWindowWidth - 540, FormWindowHeight - MenuHeight() - 275)
  ResizeGadget(TreeObjects, 10, 279, FormWindowWidth - 540, FormWindowHeight - MenuHeight() - 284)
  ResizeGadget(SplitterHorizontal, 10, 10, FormWindowWidth - 540, FormWindowHeight - MenuHeight() - 15)
  ResizeGadget(CanvasDesign, 279, 10, GadgetWidth(SplitterHorizontal) - -251, GadgetHeight(SplitterHorizontal) - 0)
  ResizeGadget(SplitterVertical, 10, 10, GadgetWidth(SplitterHorizontal) - -520, GadgetHeight(SplitterHorizontal) - 0)
EndProcedure

Procedure WindowMain_Events(event)
  Select event
    Case #PB_Event_SizeWindow
      ResizeGadgetsWindowMain()
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
        Case #MenuItemNew
        Case #MenuItemOpen
        Case #MenuItemSave
        Case #MenuItemSaveAs
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure


Main.pb:
Code:
XIncludeFile "FormMain.pbf"

OpenWindowMain()

While WindowMain_Events(WaitWindowEvent())
Wend


Designer.pbp:
Code:
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://www.purebasic.com/namespace" version="1.0" creator="PureBasic 5.60 (Linux - x64)">
  <section name="config">
    <options closefiles="1" openmode="0" name="Designer"/>
  </section>
  <section name="data">
    <explorer view="../../../" pattern="0"/>
    <log show="1"/>
    <lastopen date="2017-05-14 12:37" user="daniel" host="laplace-linux"/>
  </section>
  <section name="files"/>
  <section name="targets">
    <target name="Default Target" enabled="1" default="1">
      <inputfile value=""/>
      <outputfile value=""/>
      <options xpskin="1" debug="1"/>
    </target>
  </section>
</project>


Besides this, the complete IDE crashes when resizing the compiled application's window with this terminal message:
Code:
./launch.sh: line 1: 22712 Segmentation fault      (core dumped) ./compilers/purebasic


Video:
https://youtu.be/YbJcySHFJVM

I noticed that the application also freezes sometimes when resizing the window (see at the end of the video).

I don't know if this shouldn't be better in Bugs or Form Designer, because it includes quite a few bugs.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/