FileChooser Message on Double click

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

FileChooser Message on Double click

Post 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 7184 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: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: FileChooser Message on Double click

Post by BruceSteers »

if you set the FileChoosers ReadOnly property it does not msg but you can still select items
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: FileChooser Message on Double click

Post 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
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: FileChooser Message on Double click

Post 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? :-\
If at first you don't succeed , try doing something differently.
BruceS
User avatar
Quincunxian
Posts: 171
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: FileChooser Message on Double click

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