[Gambas-user] Wish: image path from project tree

ron ronstk at ...239...
Sat May 13 14:46:08 CEST 2006


I add simple code in FMain to be able to get the path 
of a image/object in the Data directory.

This is done to get the path of the object and able 
to paste it in the editor code.

Note: the .Visible property is not what is should be in
logical sence seen as the other above it but it looks 
that it works then only 1 time. :(

I did need a quick working method and this do the job. :)

Patch and code below
------------------------------------------------
in FMain.form
  { mnuPopup Menu
...
    { mnuPropertyFile Menu
      Text = ("&Properties...")
      Picture = Picture["img/16/sheet.png"]
    }
    { mnuCopyPath Menu
      Text = ("CopyPath")
      Picture = Picture["img/16/text.png"]
    }
  }

the entry 'mnuCopyPath' (4 lines using menu editor)
------------------------------------------------
in FMain.class
in PUBLIC SUB mnuPopup_Show()

  bFile = (NOT Project.IsClassName(sCurrent)) AND bCurrent
  mnuCut.Visible = mnuCut.Visible AND (bFile AND NOT IsDir($sKey))
  mnuCopy.Visible = mnuCopy.Visible AND (bFile AND NOT IsDir($sKey))
  mnuPaste.Visible = mnuPaste.Visible AND (bFile OR $sKey = Project.KEY_MISC) AND Clipboard.Format = FILE_CLIPBOARD_FORMAT

'<add ron copypath>
mnuCopyPath.Visible = mnuCopy.Visible 
'</add ron cp>

  mnuAddForm.Visible = Project.AllowForm()
then <add ron> part
------------------------------------------------

in FMain.class a subroutine just below the 'mnuCopy_Click()'

'<add ron>
PUBLIC SUB mnuCopyPath_Click()
  DIM sPath AS String
  sPath = GetCurrent()
  sPath = Mid$(sPath, Len(project.Dir) + 2)
  Clipboard.Copy(sPath, "text/plain") 'FILE_CLIPBOARD_FORMAT)
END
'</add ron>
------------------------------------------------


Smiling,

Ron




More information about the User mailing list