[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need information about changed filter selection in the FileChooser control


On Sat, 1 Nov 2025 at 16:18, Claus Dietrich <claus.dietrich@xxxxxxxxxx>
wrote:

> I started to draft an own file saving dialog for documents/bitmaps,
> where the compression for JPG files (also inside PDFs) shall be
> adjustable by a slider within the same dialog. However, the slider shall
> only be visible when the jpg or pdf format has been selected. So I need
> at least an information when the selection of the FileChooser filter has
> changed. The documentation of the FileChooser control lists mouse events
> but I can't catch any of them - at least not when I change the filter
> selection. Where is the mistake?
>
> Please refer to the attached snippet.
>
> Best regards
>
> Claus
>

you can add a file to your project called FileView.class and intercept the
Filter property that is set when selecting from the FileChooser...

Like this
------------ this is FileView.class

' Gambas class file
Property Filter As String[]

Event FilterChanged

Private Function Filter_Read() As String[]

  Return Super.Filter

End

Private Sub Filter_Write(Value As String[])

  Super.Filter = Value
  Raise FilterChanged

End
------------


then in your main form you can create an observer for the
FileChooser.FileView . like this....

Public Sub Form_Open()

  Dim hObs As Observer
  hObs = New Observer(FileChooser1.FileView) As "FView"

End

'' this will trigger when the FileChooser.Filter combobox sets it's
FileView.Filter
Public Sub FView_FilterChange()

  Debug FileChooser1.FilterIndex

End



Respects
BruceS

References:
Need information about changed filter selection in the FileChooser controlClaus Dietrich <claus.dietrich@xxxxxxxxxx>