Seite 1 von 1

Möchte die Dateien bitte anklicken im ListGadget damit ein Editor geöffnet wird.

Verfasst: 09.01.2022 14:27
von funkheld
Hallo, guten Tag.
Möchte die Dateien bitte anklicken im ListGadget damit ein Editor geöffnet wird.

Zur Zeit kann ich sie aus dem ListGadget in den Editor schieben.

Wie geht das bitte mit meinem ListGadget?

Ausschnitt :

Code: Alles auswählen

ExplorerListGadget(#expl_1, 10, 10, 260, 100,  "d:\vscode_zx\cspect\pebi-lib\*.f;*.bas")
SetGadgetAttribute(#expl_1,#PB_Explorer_DisplayMode,#PB_Explorer_List)
 
If EventGadget() = #expl_1 And EventType() = #PB_EventType_DragStart
   Files = ""
   For i = 0 To CountGadgetItems(#expl_1)-1
      If GetGadgetItemState(#expl_1, i) & #PB_Explorer_Selected
         Files + GetGadgetText(#expl_1) + GetGadgetItemText(#expl_1, i) + Chr(10)
      EndIf
   Next i      
   DragFiles(Files)
EndIf
Wie

Re: Möchte die Dateien bitte anklicken im ListGadget damit ein Editor geöffnet wird.

Verfasst: 09.01.2022 15:07
von mk-soft
Base Sicro

Code: Alles auswählen

Procedure.i OpenWithStandardProgram(FilePath$)
  
  Protected Result
  
  ; Avoid problems with paths containing spaces
  FilePath$ = #DQUOTE$ + FilePath$ + #DQUOTE$
  
  CompilerSelect #PB_Compiler_OS
    CompilerCase #PB_OS_Windows
      ; https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-shellexecutew
      Result = Bool(ShellExecute_(0, "open", FilePath$, #Null, #Null, #SW_SHOW) > 32)
    CompilerCase #PB_OS_Linux
      ; https://portland.freedesktop.org/doc/xdg-open.html
      Result = Bool(RunProgram("xdg-open", FilePath$, GetCurrentDirectory()))
    CompilerCase #PB_OS_MacOS
      Result = Bool(RunProgram("open", FilePath$, GetCurrentDirectory()))
  CompilerEndSelect
  
  ProcedureReturn Result
  
EndProcedure

Re: Möchte die Dateien bitte anklicken im ListGadget damit ein Editor geöffnet wird.

Verfasst: 09.01.2022 15:43
von funkheld
Danke für die Hilfe.

Gruss