FileChooser Message on Double click

Ask about the individual Gambas components here.
Post Reply
User avatar
Quincunxian
Posts: 136
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

FileChooser Message on Double click

Post by Quincunxian » Wednesday 03rd November 2021 11:40pm

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 238 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.
Cheers - Quin.
I code therefore I am

User avatar
BruceSteers
Posts: 677
Joined: Thursday 23rd July 2020 5:20pm

Re: FileChooser Message on Double click

Post by BruceSteers » Thursday 04th November 2021 10:27am

if you set the FileChoosers ReadOnly property it does not msg but you can still select items
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
cogier
Site Admin
Posts: 779
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: FileChooser Message on Double click

Post by cogier » Thursday 04th 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: -
  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

User avatar
BruceSteers
Posts: 677
Joined: Thursday 23rd July 2020 5:20pm

Re: FileChooser Message on Double click

Post by BruceSteers » Thursday 04th November 2021 3:52pm

cogier wrote:
Thursday 04th 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? :-\
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
Quincunxian
Posts: 136
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: FileChooser Message on Double click

Post by Quincunxian » Thursday 04th November 2021 7:58pm

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.
Cheers - Quin.
I code therefore I am

Post Reply