Clipboard text not copied

Sciter Forums Bug reports Clipboard text not copied

Viewing 5 reply threads
  • Author
    Posts
    • #90051
      RomanAsylum
      Participant

      Sciter: 6.0.3.11 (also checked on 6.0.3.15)
      OS: Windows 10/11

      If I try to copy selected text inside any <input type="text"> control it not happened, clipboard stay same state as was before. I also checked example sciter.samples/clipboard/test-clipboard.htm, button Put text not working correct also.

      Thanks

    • #90055
      Andrew
      Keymaster

      Cannot reproduce the problem. Checked on Windows, MacOS and Linux / Ubuntu.

      CTRL+C / CMD+C works as also Clipboard.write({}) call.

    • #90060
      RomanAsylum
      Participant

      First screenshot I press on button Read clipboard and it have some text added from another app before. I select text in textbox and press on Ctrl-C. After it I press on button Read clipboard once again, result on screenshot 2. I checked scapp and there all works correctly, it reproduced only if I run it from sciter.dll, not idea why it so.

      Attachments:
      • #90065
        Andrew
        Keymaster

        Is it in your own application? Do you call sciter::application::start(0, nullptr); like here ?

        If "yes" try the same in usciter.exe on your machine.

        • This reply was modified 1 month ago by Andrew.
        • #90067
          RomanAsylum
          Participant

          "Is it in your own application? Do you call sciter::application::start(0, nullptr); like here ?"

          yes my code below (it C#)

                  m_basicApi.SciterExec ( ApplicationCommand.SCITER_APP_INIT, 0, 0 );
          
                  // run loop for waiting close all windows
                  var code = m_basicApi.SciterExec ( ApplicationCommand.SCITER_APP_LOOP, nint.Zero, nint.Zero );
          
                  // deinitialize engine
                  m_basicApi.SciterExec ( ApplicationCommand.SCITER_APP_SHUTDOWN, nint.Zero, nint.Zero );
          

          "If "yes" try the same in usciter.exe on your machine."
          Inside usciter all works.

        • #90070
          Andrew
          Keymaster

          On Windows clipboard (and D&D) uses OLE mechanisms.

          Among other things SciterExec(SCITER_APP_INIT,...) calls OleInitialize.

          Try to call OleInitialize() before that m_basicApi.SciterExec ( ApplicationCommand.SCITER_APP_INIT, 0, 0 ); and check its return value. If it fails it means that your app initializes COM environment in conflicting to OLE manner (OleInitialize needs single-thread apartment).

    • #90072
      nsd22
      Participant

      I am experiencing a similar issue. Copying from input controls within the C# application does not work. However, copying text from an external source and pasting it into the application's input fields works correctly.

      Adding a call to OleInitialize at the start of the program did not resolve the issue:

      [DllImport("ole32.dll", CallingConvention = CallingConvention.StdCall)]
      private static extern int OleInitialize(IntPtr pvReserved);
      
      ...
      
      OleInitialize(IntPtr.Zero);
      

      Note that in the "scapp" application, everything works perfectly.

      • This reply was modified 1 month ago by nsd22.
      • This reply was modified 1 month ago by nsd22.
    • #90075
      nsd22
      Participant

      It seems the issue is resolved by adding the [STAThread] attribute to the Main method.

      [STAThread]
      static void Main()
      {
          // Your code
      }
      
      • This reply was modified 1 month ago by nsd22.
    • #90079
      RomanAsylum
      Participant

      Thanks Andrew and nsd22, it all works now

Viewing 5 reply threads
  • You must be logged in to reply to this topic.