FileChooser Message on Double click

Post

Posted
Rating:
#1 (In Topic #758)
Avatar
Expert
Quincunxian is in the usergroup ‘Expert’
When I double click a file in the file chooser I get the following message.
Image

The message

The message

(Click to enlarge)

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
Online now: Yes Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
if you set the FileChoosers ReadOnly property it does not msg but you can still select items
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Guru
cogier is in the usergroup ‘Guru’
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: -

Code (gambas)

  1.   Select Case File.Name(fvwChoose.Current)
  2.    
  3.     Case Like "*.tar.gz", "*.tar.bz2", "*.tgz", "*.tar"
  4.      
  5.       Shell "cd " & Shell(fvwChoose.Dir) & ";tar tf " & Shell$(fvwChoose.Current) To sOutput
  6.  
  7.       For Each sOutput In Split(Trim(sOutput), "\n")
  8.        
  9.         If Right(sOutput) = "/" Then
  10.           sOutput = Left$(sOutput, -1)
  11.           If Not sShow Then sShow = sOutput
  12.         Endif
  13.         sPath = fvwChoose.Dir &/ sOutput
  14.        
  15.         If Exist(sPath) Then
  16.          
  17.           If iMsg <> 1 Then
  18.             Application.Busy = 0
  19.             iMsg = Message.Warning("<b>" & sOutput & "</b><p>" & ("This file or directory already exists."), ("Overwrite all"), ("Overwrite"), ("Cancel"))
  20.             If iMsg = 3 Then Return
  21.             Inc Application.Busy
  22.           Endif
  23.          
  24.           Shell "rm -rf " & Shell$(fvwChoose.Dir &/ sOutput) Wait
  25.          
  26.         Endif
  27.        
  28.       Next

I have come up with a workaround, try the following code: -

Code (gambas)

  1. Splitter1 As Splitter
  2. DirView1 As DirView
  3. FileView1 As FileView
  4.  
  5. Public Sub Form_Open()
  6.  
  7.   With Me
  8.     .Height = 500
  9.     .Width = 800
  10.     .Padding = 5
  11.     .Arrangement = Arrange.Vertical
  12.     .Center
  13.  
  14.   Splitter1 = New Splitter(Me) As "Splitter1"
  15.   Splitter1.Expand = True
  16.  
  17.   DirView1 = New DirView(Splitter1) As "DirView1"
  18.   DirView1.Expand = True
  19.  
  20.   FileView1 = New FileView(Splitter1) As "FileView1"
  21.   FileView1.Expand = True
  22.  
  23.  
  24. Public Sub Form_Arrange()
  25.  
  26.   Splitter1.Layout = [30, 70]
  27.  
  28.  
  29. Public Sub DirView1_Click()
  30.  
  31.   FileView1.Dir = DirView1.Current
  32.  
  33.  
  34. Public Sub FileView1_DblClick()
  35.  
  36.   Message.Info("<h3>You double clicked on the file named: -\n<h1>" & FileView1.Current, "OK")
  37.  

<IMG src="https://www.cogier.com/gambas/FileChooserWorkAround.png"> </IMG>
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’

cogier said

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? :-\
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Expert
Quincunxian is in the usergroup ‘Expert’
 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
Online now: Yes Back to the top
1 guest and 0 members have just viewed this.