The files contained in this repository can be downloaded to your computer using a svn client.
On Linux you simply type the command displayed below.
This URL has Read-Only access.
root / trunk / DomotiGa / FSelectImage.class @ 821
History | View | Annotate | Download (1.1 kB)
| 1 | ' Gambas class file |
|---|---|
| 2 | |
| 3 | ' Description: |
| 4 | ' FSelectIcon.class |
| 5 | ' Provides filechooser for device icons. |
| 6 | |
| 7 | ' Development Status: |
| 8 | ' Working. |
| 9 | |
| 10 | ' DomotiGa - an open source home automation program. |
| 11 | ' Copyright(C) 2008-2009 Ron Klinkien |
| 12 | |
| 13 | ' Read file called COPYING for license details. |
| 14 | |
| 15 | PRIVATE $sIcon AS String |
| 16 | PRIVATE $sPath AS String |
| 17 | |
| 18 | PUBLIC SUB Run(sIcon AS String, sPath AS String) AS String |
| 19 | |
| 20 | $sIcon = sIcon |
| 21 | $sPath = sPath |
| 22 | IF NOT ME.ShowModal() THEN RETURN |
| 23 | RETURN $sIcon |
| 24 | |
| 25 | END |
| 26 | |
| 27 | PUBLIC SUB Form_Open() |
| 28 | |
| 29 | DIM iPos AS Integer |
| 30 | |
| 31 | INC Application.Busy |
| 32 | fchIcon.Filter = ["*.png,*.jpg,*.jpeg,*.xpm,*.gif", ("Picture files")]
|
| 33 | fchIcon.Root = Main.sBaseDir &/ $sPath |
| 34 | |
| 35 | IF $sIcon THEN |
| 36 | fchIcon.SelectedPath = $sIcon |
| 37 | ENDIF |
| 38 | |
| 39 | DEC Application.Busy |
| 40 | |
| 41 | END |
| 42 | |
| 43 | PUBLIC SUB btnCancel_Click() |
| 44 | |
| 45 | ME.Close |
| 46 | |
| 47 | END |
| 48 | |
| 49 | PUBLIC SUB btnOK_Click() |
| 50 | |
| 51 | DIM iSpot AS Integer |
| 52 | |
| 53 | ' return only filename part |
| 54 | $sIcon = fchIcon.SelectedPath |
| 55 | iSpot = RInStr($sIcon, "/") |
| 56 | $sIcon = Mid$($sIcon, iSpot + 1, Len($sIcon) - iSpot) |
| 57 | |
| 58 | IF NOT $sIcon THEN RETURN |
| 59 | ME.Close(TRUE) |
| 60 | |
| 61 | END |
| 62 | |
| 63 | PUBLIC SUB fchIcon_Activate() |
| 64 | |
| 65 | btnOK.Value = TRUE |
| 66 | |
| 67 | END |
