Seite 1 von 1

win_api -> Linux

Verfasst: 14.09.2014 18:43
von schleicher
Kann mir mal jeman sagen, wie die Winapi Konstanten #WM_COPY, #WM_PASTE bei Linux lauten ?


gtk_ ...... ?

Re: win_api -> Linux

Verfasst: 14.09.2014 19:20
von ts-soft
Die gibt es nicht, so einfach läßt sich die API nicht wechseln :lol:

Hier mal ein kleines Beispiel:

Code: Alles auswählen

ImportC ""
  g_signal_emit_by_name(*inst, name.p-utf8)
EndImport

OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 480, "")
EditorGadget(0, 10, 10, 620, 460)

SetClipboardText("Hallo die Enten")

g_signal_emit_by_name(GadgetID(0), "paste-clipboard")

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Hier wird "Hallo die Enten" ins EditorGadget gepasted.

Copy geht dann mit "copy-clipboard"

Re: win_api -> Linux

Verfasst: 14.09.2014 19:37
von ts-soft
Hier nochmal der Crossplattform Ansatz, jedoch ohne MacOS:

Code: Alles auswählen

EnableExplicit

CompilerIf #PB_Compiler_OS  = #PB_OS_Linux
  ImportC ""
    g_signal_emit_by_name(*inst, name.p-utf8)
  EndImport
CompilerEndIf

OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 480, "")
EditorGadget(0, 10, 10, 620, 460)

SetClipboardText("Hallo die Enten")

CompilerSelect #PB_Compiler_OS
  CompilerCase #PB_OS_Windows
    SendMessage_(GadgetID(0), #WM_PASTE, 0, 0)
  CompilerCase #PB_OS_Linux
    g_signal_emit_by_name(GadgetID(0), "paste-clipboard")
CompilerEndSelect

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow 

Re: win_api -> Linux

Verfasst: 14.09.2014 19:49
von schleicher
Aha. Danke schön.