KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Possible StatusBar bug

 
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Tue Jul 13, 2004 12:55 pm    Post subject: Possible StatusBar bug Reply with quote

Unless I am coding something wrong, I think I found a little bug when hiding and showing the status bar.

If you try the hiding and showing the statusbar, you will see that the treeview and listview do not resize themselves properly. This causes the bottom about 30 pixels to be hidden.

I used we.kix to give an example. My additions are in all CAPS.

Code:

Break On

$System = CreateObject("Kixtart.System")

$Form = $System.Form()
$Form.Text = "File Explorer"
$Form.Size = 640,480
$Form.DockPadding = 2,2,2,2

$Form.Menu = $System.MainMenu()
$Form.Menu.Style = 1
$Form.Menu.ImageList = $System.BuiltinImageList

$FileMenu = $Form.Menu.MenuItems.Add("File")

$ExitMenu = $FileMenu.MenuItems.Add("Exit","quit()","Ctrl+X")
$ExitMenu.ImageIndex = 60

$ViewMenu = $Form.Menu.MenuItems.Add("View")

$SmallViewMenu = $ViewMenu.MenuItems.Add("Icons")
$SmallViewMenu.OnClick = "OnViewClick(2)"
$SmallViewMenu.ImageIndex = 40

$ListViewMenu = $ViewMenu.MenuItems.Add("List")
$LIstViewMenu.OnClick = "OnViewClick(3)"
$ListViewMenu.ImageIndex = 39

$DetailsMenu = $ViewMenu.MenuItems.Add("Details")
$DetailsMenu.OnClick = "OnViewClick(1)"
$DetailsMenu.ImageIndex = 41

$STATUSBARMENU = $VIEWMENU.MENUITEMS.ADD("STATUS BAR")
$STATUSBARMENU.ONCLICK = "STATUSBARCLICK()"
;$STATUSBARMENU.IMAGEINDEX = 41

$ToolBar1 = $Form.GroupBox()
$ToolBar1.Height = 30
$ToolBar1.Dock = "Top"
$ToolBar1.DockPadding = 2,2,2,2

$BackButton = $ToolBar1.ToolButton()
$BackButton.Dock = "Left"
$BackButton.Icon = 18
$BackButton.Width = 30

$StatusBar1 = $Form.StatusBar()
$StatusBar1.Dock = "Bottom"

$TreeView1 = $Form.TreeView()
$TreeView1.Dock = "Left"
$TreeView1.ImageList = $System.BuiltinImageList()
$TreeView1.ImageIndex = 45
$TreeView1.SelectedImageIndex = 46
$TreeView1.OnBeforeExpand = "OnBeforeExpand()"
$TreeView1.OnAfterSelect = "OnAfterSelect()"
$TreeView1.HideSelection = 0

$Node = $TreeView1.Nodes.Add("c:\")

$TreeView1.ContextMenu = $System.ContextMenu()
$TreeView1.ContextMenu.Style = 1

$ExpandMenu = $TreeView1.ContextMenu.MenuItems.Add("Expand")
$ExpandMenu.Visible = 1
$ExpandMenu.Onclick = "OnExpandClick()"

$CollapseMenu = $TreeView1.ContextMenu.MenuItems.Add("Collapse")
$CollapseMenu.Visible = 0
$CollapseMenu.OnClick = "OnCollapseClick()"

$Splitter = $Form.Splitter()

$ListView1 = $Form.ListView()
$ListView1.Dock = "Fill"
$ListView1.OnDoubleClick = "ListViewDoubleClick()"

$= $ListView1.Columns.Add("Name",200,$System.HorizontalAlignment.Left );
$= $ListView1.Columns.Add("Size",70,$System.HorizontalAlignment.Right );
$= $ListView1.Columns.Add("Date Modified",200,$System.HorizontalAlignment.Left );

$ListView1.ContextMenu = $System.ContextMenu()
$ListView1.ContextMenu.Style = 1

$PropertiesMenu = $ListView1.ContextMenu.MenuItems.Add("Properties...")

;
; Load application icons
;

$ListView1.SmallImageList = $System.BuiltinImageList

$FSO = CreateObject("Scripting.FileSystemObject")

$Form.Center
$Form.Show

DisplayChildNodes($Node)
$Node.Expand()

While $Form.Visible
 $=Execute($Form.DoEvents)
Loop

Exit 1

FUNCTION STATUSBARCLICK()
   IF $STATUSBAR1.VISIBLE
      $STATUSBAR1.HIDE
   ELSE
      $STATUSBAR1.SHOW
   ENDIF
   $TREEVIEW1.HEIGHT = $SYSTEM.ACTIVEFORM.CLIENTHEIGHT
   $LISTVIEW1.HEIGHT = $SYSTEM.ACTIVEFORM.CLIENTHEIGHT
   $TREEVIEW1.REFRESH
   $STATUSBAR1.REFRESH
ENDFUNCTION

Function OnBeforeExpand()

; $TreeView1.EventNode.Nodes.Clear()

 DisplayChildNodes($TreeView1.EventNode)

 $TreeView1.EventNode.Expand()

EndFunction

Function DisplayChildNodes($ParentNode)

 Dim $folder, $subfolder, $node

 $Form.Cursor = $System.CursorStyle.WaitCursor

 $Folder = $FSO.GetFolder(TVGetFullPath($parentNode))

 $ParentNode.Nodes.Clear()

 For Each $SubFolder In $Folder.SubFolders

  $node = $parentNode.Nodes.Add()
  $node.Text = $SubFolder.Name
 
  If $SubFolder.SubFolders.Count
   $= $node.Nodes.Add("")
  Endif

 Next

 $Form.Cursor = $System.CursorStyle.Default

EndFunction

Function OnAfterSelect()

 Dim $node, $path, $folder, $file, $item, $column

 $Node = $TreeView1.SelectedNode
 If Not $Node Return Endif

 ;DisplayChildNodes($TreeView1.SelectedNode)

 $Form.Cursor = $System.CursorStyle.WaitCursor;

 $path = TVGetFullPath($node)

 $StatusBar1.Text = "Refreshing folder " + $path + ". Please wait...";

 If $path

  $folder = $FSO.GetFolder($path)

  If $folder

   $ListView1.BeginUpdate()

   $ListView1.Items.Clear()

   For Each $subfolder In $folder.subfolders

     $item = $ListView1.Items.Add($subfolder.Name,45);

   Next

   For Each $file In $folder.Files

     $item = $ListView1.Items.Add($file.Name,0);
     $item.SubItems(1).Text = $file.Size
     $item.SubItems(2).Text = $file.DatelastModified

   Next

   $ListView1.EndUpdate()
   $StatusBar1.Text = $path;

  Else

   $StatusBar1.Text = @SERROR

  Endif

 Endif

 $Form.Cursor = $System.CursorStyle.Default;

 Return;

EndFunction

Function OnExpandClick()

 Dim $ClientPoint, $Node

 $ClientPoint = $TreeView1.PointToClient($System.EventArgs.X, $System.EventArgs.Y)
 $Node = $TreeView1.GetNodeAt($ClientPoint)
 If Not $Node Return Endif

EndFunction

Function OnCollapseClick()

EndFunction

Function OnViewClick($view)

 $ListView1.View = $view

EndFunction

Function TVGetFullPath($node, Optional $delim)

 dim $path

 If Not $Delim
  $Delim = "\"
 Endif

 $path = $node.Text

 $parent = $node.parent

 If $parent
  $path = TVGetFullPath($parent,$delim) + $delim + $node.Text
 Endif

 $TVGetFullPath = $path

EndFunction

Function ListViewDoubleClick()

 $Folder = $ListView1.FocusedItem.Text

 If Not $TreeView1.SelectedNode.IsExpanded
  DisplayChildNodes($TreeView1.SelectedNode);
  $TreeView1.SelectedNode.Expand();
 Endif

 For $i = 0 to $TreeView1.SelectedNode.Nodes.Count - 1
  If $TreeView1.SelectedNode.Nodes($i).Text = $ListView1.FocusedItem.Text
   $TreeView1.SelectedNode = $TreeView1.SelectedNode.Nodes($i)
   ;?"EnsureVisible=" + $TreeView1.SelectedNode.Nodes($i).Text
   ;$TreeView1.SelectedNode.Nodes($i).EnsureVisible()
  Endif
 Next

; $Folder = TVGetFullPath($TreeView1.SelectedNode) + "\" + $Folder

EndFunction

_________________
Kelly


Last edited by krabourn on Tue Jul 13, 2004 1:45 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Tue Jul 13, 2004 1:22 pm    Post subject: Reply with quote

what would that bug be?
_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Tue Jul 13, 2004 1:45 pm    Post subject: Reply with quote

Sorry, busy at work and did not finish.

If you try the hiding and showing the statusbar, you will see that the treeview and listview do not resize themselves properly. This causes the bottom about 30 pixels to be hidden.

_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Jul 13, 2004 3:04 pm    Post subject: Reply with quote

I did not build that functionality into kf yet. I assume your using docked controls ? Just a matter of me coding it really. In the short-term, wondering if a coded solution could be found.
Back to top
View user's profile Send private message
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Tue Jul 13, 2004 4:15 pm    Post subject: Reply with quote

If I can determine the height of the statusbar I can resize the treeview and the listview. I assume the forms client height is not changing when the statusbar's visibility changed. Is that correct?
_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Jul 13, 2004 4:23 pm    Post subject: Reply with quote

without checking, ja - the statusbar is just like any other control. so if you hide it then resize the tv/lv accordingly - should work. i know what your up to - your building in one of those hide toolbar/statusbar menu thingies ja ?
Back to top
View user's profile Send private message
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Tue Jul 13, 2004 4:42 pm    Post subject: Reply with quote

Yes. I was going to tell you the other day, but you were too busy having fun.
_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Tue Jul 13, 2004 5:04 pm    Post subject: Reply with quote

Here you go.

Code:
Break On

$System = CreateObject("Kixtart.System")

$Form = $System.Form()
$Form.Text = "File Explorer"
$Form.Size = 640,480
$Form.DockPadding = 2,2,2,2

$Form.Menu = $System.MainMenu()
$Form.Menu.Style = 1
$Form.Menu.ImageList = $System.BuiltinImageList

$FileMenu = $Form.Menu.MenuItems.Add("File")

$ExitMenu = $FileMenu.MenuItems.Add("Exit","quit()","Ctrl+X")
$ExitMenu.ImageIndex = 60

$ViewMenu = $Form.Menu.MenuItems.Add("View")

$SmallViewMenu = $ViewMenu.MenuItems.Add("Icons")
$SmallViewMenu.OnClick = "OnViewClick(2)"
$SmallViewMenu.ImageIndex = 40

$ListViewMenu = $ViewMenu.MenuItems.Add("List")
$LIstViewMenu.OnClick = "OnViewClick(3)"
$ListViewMenu.ImageIndex = 39

$DetailsMenu = $ViewMenu.MenuItems.Add("Details")
$DetailsMenu.OnClick = "OnViewClick(1)"
$DetailsMenu.ImageIndex = 41

$StatusbarMenu = $VIEWMENU.MENUITEMS.ADD("Hide Statusbar")
$StatusbarMenu.ONCLICK = "StatusbarClick()"
;$StatusbarMenu.IMAGEINDEX = 41

$ToolbarMenu = $VIEWMENU.MENUITEMS.ADD("Hide Toolbar")
$ToolbarMenu.ONCLICK = "ToolbarClick()"
;$ToolbarMenu.IMAGEINDEX = 41

$ToolBar1 = $Form.GroupBox()
$ToolBar1.Height = 30
$ToolBar1.Dock = "Top"
$ToolBar1.DockPadding = 2,2,2,2
$ToolBar1.Tag = $ToolBar1.Height

$BackButton = $ToolBar1.ToolButton()
$BackButton.Dock = "Left"
$BackButton.Icon = 18
$BackButton.Width = 30

$StatusBar1 = $Form.StatusBar()
$StatusBar1.Dock = "Bottom"
$StatusBar1.Tag = $STATUSBAR1.Height

$TreeView1 = $Form.TreeView()
$TreeView1.Dock = "Left"
$TreeView1.ImageList = $System.BuiltinImageList()
$TreeView1.ImageIndex = 45
$TreeView1.SelectedImageIndex = 46
$TreeView1.OnBeforeExpand = "OnBeforeExpand()"
$TreeView1.OnAfterSelect = "OnAfterSelect()"
$TreeView1.HideSelection = 0

$Node = $TreeView1.Nodes.Add("c:\")

$TreeView1.ContextMenu = $System.ContextMenu()
$TreeView1.ContextMenu.Style = 1

$ExpandMenu = $TreeView1.ContextMenu.MenuItems.Add("Expand")
$ExpandMenu.Visible = 1
$ExpandMenu.Onclick = "OnExpandClick()"

$CollapseMenu = $TreeView1.ContextMenu.MenuItems.Add("Collapse")
$CollapseMenu.Visible = 0
$CollapseMenu.OnClick = "OnCollapseClick()"

$Splitter = $Form.Splitter()

$ListView1 = $Form.ListView()
$ListView1.Dock = "Fill"
$ListView1.OnDoubleClick = "ListViewDoubleClick()"

$= $ListView1.Columns.Add("Name",200,$System.HorizontalAlignment.Left );
$= $ListView1.Columns.Add("Size",70,$System.HorizontalAlignment.Right );
$= $ListView1.Columns.Add("Date Modified",200,$System.HorizontalAlignment.Left );

$ListView1.ContextMenu = $System.ContextMenu()
$ListView1.ContextMenu.Style = 1

$PropertiesMenu = $ListView1.ContextMenu.MenuItems.Add("Properties...")

;
; Load application icons
;

$ListView1.SmallImageList = $System.BuiltinImageList

$FSO = CreateObject("Scripting.FileSystemObject")

$Form.Center
$Form.Show

DisplayChildNodes($Node)
$Node.Expand()

While $Form.Visible
 $=Execute($Form.DoEvents)
Loop

Exit 1

FUNCTION ToolbarClick()
   IF $ToolBar1.VISIBLE
      $ToolBar1.HEIGHT = 0
      $TreeView1.TOP = $TreeView1.TOP - $ToolBar1.TAG
      $ListView1.TOP = $ListView1.TOP - $ToolBar1.TAG
      $TreeView1.HEIGHT = $TreeView1.HEIGHT + $ToolBar1.TAG
      $ListView1.HEIGHT = $ListView1.HEIGHT + $ToolBar1.TAG
      $ToolBar1.HIDE
      $ToolbarMenu.TEXT = "Show Toolbar"
   ELSE
      $ToolBar1.HEIGHT = $ToolBar1.TAG
      $TreeView1.TOP = $TreeView1.TOP + $ToolBar1.TAG
      $ListView1.TOP = $ListView1.TOP + $ToolBar1.TAG
      $TreeView1.HEIGHT = $TreeView1.HEIGHT - $ToolBar1.TAG
      $ListView1.HEIGHT = $ListView1.HEIGHT - $ToolBar1.TAG
      $ToolBar1.SHOW
      $ToolbarMenu.TEXT = "Hide Toolbar"
   ENDIF
ENDFUNCTION

FUNCTION StatusbarClick()
   IF $StatusBar1.VISIBLE
      $StatusBar1.HEIGHT = 0
      $TreeView1.HEIGHT = $TreeView1.HEIGHT + $StatusBar1.TAG
      $ListView1.HEIGHT = $ListView1.HEIGHT + $StatusBar1.TAG
      $StatusBar1.HIDE
      $StatusbarMenu.Text = "Show Statusbar"
   ELSE
      $StatusBar1.HEIGHT = $StatusBar1.TAG
      $TreeView1.HEIGHT = $TreeView1.HEIGHT - $StatusBar1.TAG
      $ListView1.HEIGHT = $ListView1.HEIGHT - $StatusBar1.TAG
      $StatusBar1.SHOW
      $StatusbarMenu.TEXT = "Hide Statusbar"
   ENDIF
ENDFUNCTION

Function OnBeforeExpand()

; $TreeView1.EventNode.Nodes.Clear()

 DisplayChildNodes($TreeView1.EventNode)

 $TreeView1.EventNode.Expand()

EndFunction

Function DisplayChildNodes($ParentNode)

 Dim $folder, $subfolder, $node

 $Form.Cursor = $System.CursorStyle.WaitCursor

 $Folder = $FSO.GetFolder(TVGetFullPath($parentNode))

 $ParentNode.Nodes.Clear()

 For Each $SubFolder In $Folder.SubFolders

  $node = $parentNode.Nodes.Add()
  $node.Text = $SubFolder.Name
 
  If $SubFolder.SubFolders.Count
   $= $node.Nodes.Add("")
  Endif

 Next

 $Form.Cursor = $System.CursorStyle.Default

EndFunction

Function OnAfterSelect()

 Dim $node, $path, $folder, $file, $item, $column

 $Node = $TreeView1.SelectedNode
 If Not $Node Return Endif

 ;DisplayChildNodes($TreeView1.SelectedNode)

 $Form.Cursor = $System.CursorStyle.WaitCursor;

 $path = TVGetFullPath($node)

 $StatusBar1.Text = "Refreshing folder " + $path + ". Please wait...";

 If $path

  $folder = $FSO.GetFolder($path)

  If $folder

   $ListView1.BeginUpdate()

   $ListView1.Items.Clear()

   For Each $subfolder In $folder.subfolders

     $item = $ListView1.Items.Add($subfolder.Name,45);

   Next

   For Each $file In $folder.Files

     $item = $ListView1.Items.Add($file.Name,0);
     $item.SubItems(1).Text = $file.Size
     $item.SubItems(2).Text = $file.DatelastModified

   Next

   $ListView1.EndUpdate()
   $StatusBar1.Text = $path;

  Else

   $StatusBar1.Text = @SERROR

  Endif

 Endif

 $Form.Cursor = $System.CursorStyle.Default;

 Return;

EndFunction

Function OnExpandClick()

 Dim $ClientPoint, $Node

 $ClientPoint = $TreeView1.PointToClient($System.EventArgs.X, $System.EventArgs.Y)
 $Node = $TreeView1.GetNodeAt($ClientPoint)
 If Not $Node Return Endif

EndFunction

Function OnCollapseClick()

EndFunction

Function OnViewClick($view)

 $ListView1.View = $view

EndFunction

Function TVGetFullPath($node, Optional $delim)

 dim $path

 If Not $Delim
  $Delim = "\"
 Endif

 $path = $node.Text

 $parent = $node.parent

 If $parent
  $path = TVGetFullPath($parent,$delim) + $delim + $node.Text
 Endif

 $TVGetFullPath = $path

EndFunction

Function ListViewDoubleClick()

 $Folder = $ListView1.FocusedItem.Text

 If Not $TreeView1.SelectedNode.IsExpanded
  DisplayChildNodes($TreeView1.SelectedNode);
  $TreeView1.SelectedNode.Expand();
 Endif

 For $i = 0 to $TreeView1.SelectedNode.Nodes.Count - 1
  If $TreeView1.SelectedNode.Nodes($i).Text = $ListView1.FocusedItem.Text
   $TreeView1.SelectedNode = $TreeView1.SelectedNode.Nodes($i)
   ;?"EnsureVisible=" + $TreeView1.SelectedNode.Nodes($i).Text
   ;$TreeView1.SelectedNode.Nodes($i).EnsureVisible()
  Endif
 Next

; $Folder = TVGetFullPath($TreeView1.SelectedNode) + "\" + $Folder

EndFunction

_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group