Virtual Pascal

Classic Object Pascal for free

I haven't explicitly enabled mouse support in my program but when it loads in a command window on Windows 7/10 x64 I can use the mouse to click on menus and dialogs as well as drag windows around inside the app.  But creating specific new windows the mouse support suddenly disappears and it's back to the keyboard.  When I launch a separate process (in a new command window) and return back to my app the mouse support returns to normal.

Any one have experience with this or any way that I can ensure that the mouse support is re-enabled again?

Jeremy

Views: 44

Reply to This

Replies to This Discussion

I know how 2 fix this problem on windows 10, I will add snap shots later on how 2 fix this problem with Mouse in Command window on OS - Windows 10

Thanks. Awaiting your update...

Thank you for the reply.  Yes this is true for the IDE being hosted in a console window, but I was referring to my application, these settings also affect it in the way that you mentioned but the issue is within the application itself.

I've tried to edit an example for illustration below (the mouse interaction works when compiled with Turbo Pascal).  Once the window is inserted it works fine with the keyboard (can move anywhere in document and access the menu of the main app) but the mouse support disappears (cannot click on the scroll bars or menu items).  However, if I run a shell to another program from this one (calls a different program to chart something) then return back to this app, the mouse interaction as well as the keyboard works the way it originally does in Turbo Pascal.

   W := CreateFileEditWindow(WorkFileName, '');
   IF (W <> nil) THEN Desktop^.Insert(W);

   PDSFileEditWindow = ^TDSFileEditWindow;
   TDSFileEditWindow = object(TWindow)
      DSFileEditor      : PDSFileEditor;
      UntitledDSNumber  : word;

      function GetTitle(MaxSize: Integer): TTitleStr; virtual;
      procedure HandleEvent(var Event: TEvent); virtual;
   END;

FUNCTION CreateFileEditWindow(WorkFileName   : String;
                                 FileName       : String): PWindow;
VAR
   ViewFileName   : String;
   R              : TRect;
   HScrollBar     : PScrollBar;
   VScrollBar     : PScrollBar;
   W              : PWindow;
BEGIN
   CreateFileEditWindow := NIL;

   ViewFileName := GetUniqueFileName;
   IF NOT CreateViewFile(WorkFileName, FileName, ViewFileName) then
   BEGIN
      MessageBox(AppError.GetMsg, nil, mfError+mfOKButton);
      EXIT;
   END;

   Desktop^.GetExtent(R);
   W := PWindow(Application^.ValidView(New(PDSFileEditWindow, Init(R, '', 0))));
   IF ( W <> NIL ) THEN
   BEGIN
      WITH PDSFileEditWindow(W)^ DO
      BEGIN
         HScrollBar := StandardScrollBar(sbHorizontal + sbHandleKeyboard);
         VScrollBar := StandardScrollBar(sbVertical + sbHandleKeyboard);
         Options := Options or ofTileable;
         IF ( FileName = '' ) THEN
         BEGIN
            INC(UntitledNumber);
            UntitledDSNumber := UntitledNumber;
         END;
         GetExtent(R);
         R.Grow(-1, -1);
         DSFileEditor := New(PRDSFileEditor, Init(R, HScrollBar, VScrollBar,
            WorkRDSFileName, RDSFileName, ViewFileName));
         Insert(DSFileEditor);
      END;
   END;

   CreateFileEditWindow := W;
END;

RSS

© 2017   Created by Allan Mertner.   Powered by

Report an Issue  |  Terms of Service