[Gambas-user] About Dirview control.

Jorge Carrión shordi at ...626...
Tue Apr 1 09:44:24 CEST 2014


Benoit:
Related with my last message about a Dirview problem (can't create a Folder
when the folder's list its too big for be shown in screen and the "New
Folder" line isn't visible), I've found a solution... but I don't know if
it's a bug or just a bad use of class by my side.
I've downloaded the DirView Class code from Gambasdoc and -after comment
the Inherits UserControl Line- I've modified the NewFolder sub:

Public Sub NewFolder()

  Dim sDir As String
  Dim sPath As String
  Dim iInd As Integer
  Dim clave As String

  sDir = ("New Folder")
  clave = $hTreeView.Current.Key
  iInd = 1

  Do
    If Not Exist(clave &/ sDir) Then Break
    Inc iInd
    sDir = ("New Folder") & " (" & CStr(iInd) & ")"
  Loop

  sPath = clave &/ sDir
  Mkdir sPath
  AddDir(clave, sDir)
  $bDeleteOnCancel = True
  $bInRename = True

           ' 'The next two lines are mine
  $hTreeView[sPath].EnsureVisible
  Wait 0.01

  $hTreeView[sPath].Rename

Catch

  Message.Error(("Cannot create directory.") & "\n\n" & Error.Text)

End

Now it works as I expected -The new Folder is created even it's row isn't
visible-. BUT I don't know if this modification is "correct" or interferes
in some other behaviour of the class...
Can you give some feedback about this topic?

Regards



More information about the User mailing list