Page 1 of 1

FileChooser Message on Double click

Posted: Wednesday 3rd November 2021 11:40pm
by Quincunxian
When I double click a file in the file chooser I get the following message.
The message
The message
Screenshot from 2021-11-04 10-33-57.png (11.22 KiB) Viewed 7164 times
Is there anyway to disable it ?
This appears before the 'Activate' process instigates.
When you click on 'Overwrite' the process then continues as normal.

Any suggestions ?

Note# this is not specific to any one project. I get this in all instances where the FileChooser component is being used.

Re: FileChooser Message on Double click

Posted: Thursday 4th November 2021 10:27am
by BruceSteers
if you set the FileChoosers ReadOnly property it does not msg but you can still select items

Re: FileChooser Message on Double click

Posted: Thursday 4th November 2021 3:24pm
by cogier
This seems to be a bug. I can't find a way to capture the _DblClick() event. I even tried adding an Observer without success. The problem seems to have something to do with the FileChooser_Uncompress() routine which is in the FDirChooser.Class. Part of the code is below: -
  Select Case File.Name(fvwChoose.Current)
    
    Case Like "*.tar.gz", "*.tar.bz2", "*.tgz", "*.tar"
      
      Shell "cd " & Shell(fvwChoose.Dir) & ";tar tf " & Shell$(fvwChoose.Current) To sOutput
  
      For Each sOutput In Split(Trim(sOutput), "\n")
        
        If Right(sOutput) = "/" Then 
          sOutput = Left$(sOutput, -1)
          If Not sShow Then sShow = sOutput
        Endif
        sPath = fvwChoose.Dir &/ sOutput
        
        If Exist(sPath) Then
          
          If iMsg <> 1 Then
            Application.Busy = 0
            iMsg = Message.Warning("<b>" & sOutput & "</b><p>" & ("This file or directory already exists."), ("Overwrite all"), ("Overwrite"), ("Cancel"))
            If iMsg = 3 Then Return
            Inc Application.Busy
          Endif
          
          Shell "rm -rf " & Shell$(fvwChoose.Dir &/ sOutput) Wait
          
        Endif
        
      Next


I have come up with a workaround, try the following code: -
Splitter1 As Splitter
DirView1 As DirView
FileView1 As FileView

Public Sub Form_Open()

  With Me
    .Height = 500
    .Width = 800
    .Padding = 5
    .Arrangement = Arrange.Vertical
    .Center
  End With

  Splitter1 = New Splitter(Me) As "Splitter1"
  Splitter1.Expand = True

  DirView1 = New DirView(Splitter1) As "DirView1"
  DirView1.Expand = True

  FileView1 = New FileView(Splitter1) As "FileView1"
  FileView1.Expand = True

End

Public Sub Form_Arrange()

  Splitter1.Layout = [30, 70]

End

Public Sub DirView1_Click()

  FileView1.Dir = DirView1.Current

End

Public Sub FileView1_DblClick()

  Message.Info("<h3>You double clicked on the file named: -\n<h1>" & FileView1.Current, "OK")

End
Image

Re: FileChooser Message on Double click

Posted: Thursday 4th November 2021 3:52pm
by BruceSteers
cogier wrote: Thursday 4th November 2021 3:24pm This seems to be a bug. I can't find a way to capture the _DblClick() event. I even tried adding an Observer without success. The problem seems to have something to do with the FileChooser_Uncompress() routine which is in the FDirChooser.Class. Part of the code is below: -
Yeah FileChooser _DblCick does not do anything (there's some other controls have the same behaviour). The _Activate event fires on _DblClick instead for some reason? :-\

Re: FileChooser Message on Double click

Posted: Thursday 4th November 2021 7:58pm
by Quincunxian
That fixed it.
Changing the FileChooser property ReadOnly to True stopped the pop-up message.
This has annoyed me for such a long time - thanks guys !

I use the Activate event to process a file selection on double click.

Edit: The reason that the Activate event is used, 'may' be that when you have a standard control like FileChooser, where it is made up of two controls;
Which control is being double clicked? I imagine that under the covers, there are two distinct double click events that are merged into an Activate event.
This is a guess but should not be too far from the truth.