Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #11877 > unrolled thread

Stop a window from moving

Started byJeff Rollo <jrollo64@gmail.com>
First post2018-09-06 03:53 -0700
Last post2018-09-09 23:31 -0700
Articles 17 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-06 03:53 -0700
    Re: Stop a window from moving JohnMartens <martens@tennishulp.info> - 2018-09-06 15:08 +0200
      Re: Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-06 06:30 -0700
        Re: Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-06 06:38 -0700
          Re: Stop a window from moving Leo_Bond <l.bond@bk.ru> - 2018-09-06 06:58 -0700
            Re: Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-06 15:42 -0700
      Re: Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-06 18:54 -0700
        Re: Stop a window from moving JohnMartens <martens@tennishulp.info> - 2018-09-07 07:40 +0200
          Re: Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-06 23:23 -0700
            Re: Stop a window from moving JohnMartens <martens@tennishulp.info> - 2018-09-07 12:27 +0200
            Re: Stop a window from moving "Karl-Heinz" <invalid@invalid.invalid> - 2018-09-07 12:38 +0200
              Re: Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-07 17:36 -0700
                Re: Stop a window from moving "Karl-Heinz" <invalid@invalid.invalid> - 2018-09-09 11:42 +0200
                  Re: Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-09 06:27 -0700
                  Re: Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-09 06:34 -0700
                    Re: Stop a window from moving "Karl-Heinz" <invalid@invalid.invalid> - 2018-09-10 07:37 +0200
                      Re: Stop a window from moving Jeff Rollo <jrollo64@gmail.com> - 2018-09-09 23:31 -0700

#11877 — Stop a window from moving

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-06 03:53 -0700
SubjectStop a window from moving
Message-ID<9c17839e-ef94-4b6a-bd94-2ee38dc0fe6b@googlegroups.com>
Hi again. Small problem, I need to stop windows from being moved. They start centred and I need for them to stay that way. DataWindows mostly and one dialog window

Any ideas will be gratefully received.

[toc] | [next] | [standalone]


#11879

FromJohnMartens <martens@tennishulp.info>
Date2018-09-06 15:08 +0200
Message-ID<pmr8t2$fgl$1@dont-email.me>
In reply to#11877
You could use something like this. It will place the window back on its 
original position every second

METHOD Timer() CLASS frmMyFixedPositionWindow
	SELF:Origin := SELF:pTheFixedPosition
RETURN NIL

METHOD PostInit() CLASS frmMyFixedPositionWindow
	self:RegisterTimer(1,TRUE)
	SELF:pTheFixedPosition := SELF:Origin
RETURN NIL

Does that help ?

John


Op 6-9-2018 om 12:53 schreef Jeff Rollo:
> Hi again. Small problem, I need to stop windows from being moved. They start centred and I need for them to stay that way. DataWindows mostly and one dialog window
> 
> Any ideas will be gratefully received.
> 

[toc] | [prev] | [next] | [standalone]


#11881

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-06 06:30 -0700
Message-ID<09e78f1a-58dc-489d-9132-74596e5bd872@googlegroups.com>
In reply to#11879
METHOD Timer() CLASS Clients 
        self:Origin := self:pTheFixedPosition 
RETURN nil 

METHOD PostInit() CLASS Clients
        self:RegisterTimer(1,true) 
        self:pTheFixedPosition := self:Origin 
RETURN nil 

CLIENTS is the DataWindow CLASS of the form I'm trying to apply this to.

Very sorry if I'm thick. As I say, it has been almost 20 years....

[toc] | [prev] | [next] | [standalone]


#11883

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-06 06:38 -0700
Message-ID<c19deb0c-9299-4771-8aa9-93f84454e5c8@googlegroups.com>
In reply to#11881
One error is: PTHEFIXEDPOSITION is not an Assign of CLIENTS IN THE PostInit and the Timer.

Both are not accessible in class CLIENTS.

[toc] | [prev] | [next] | [standalone]


#11884

FromLeo_Bond <l.bond@bk.ru>
Date2018-09-06 06:58 -0700
Message-ID<51472843-3abd-41aa-8897-bb8ed9d0f29d@googlegroups.com>
In reply to#11883
четверг, 6 сентября 2018 г., 16:38:25 UTC+3 пользователь Jeff Rollo написал:
> One error is: PTHEFIXEDPOSITION is not an Assign of CLIENTS IN THE PostInit and the Timer.
> 
> Both are not accessible in class CLIENTS.

1. Try to change class name CLIENTS to your window class name if it is not CLIENTS.
2. In your class declaration declare pTheFixedPosition variable
Something like this: PROTECT pTheFixedPosition AS Point

[toc] | [prev] | [next] | [standalone]


#11887

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-06 15:42 -0700
Message-ID<3069e488-7d37-485e-a373-da816e595ebc@googlegroups.com>
In reply to#11884
Thanks Leo, that's going in the right direction, but still not it. I have a Dialog window which is completely unmovable. I'd ideally like to achieve the same result in my datawindows.

[toc] | [prev] | [next] | [standalone]


#11888

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-06 18:54 -0700
Message-ID<bc3f0565-c590-45a6-80b1-caa117a988a6@googlegroups.com>
In reply to#11879
Hi John, yep, that will do as a work around, thank you very much. Ideally I want to stop movement and resizing completely.

[toc] | [prev] | [next] | [standalone]


#11889

FromJohnMartens <martens@tennishulp.info>
Date2018-09-07 07:40 +0200
Message-ID<pmt2vi$1b0$1@dont-email.me>
In reply to#11888
Call NoResize in the PostInit of the data window

METHOD NoResize() CLASS DataWindow
	* method to force a data window not to be resizable
	SELF:EnableBorder(WINDOWNONSIZINGBORDER)
	SELF:EnableMaxBox(FALSE )
	SetWindowPos(SELF:Handle(), NULL_PTR,0,0,0,0,_OR(SWP_FRAMECHANGED, 
SWP_NOZORDER, SWP_NOSIZE, SWP_NOMOVE))
RETURN SELF

Try adding SWP_NOMOVE for also not moving

John



Op 7-9-2018 om 03:54 schreef Jeff Rollo:
> Hi John, yep, that will do as a work around, thank you very much. Ideally I want to stop movement and resizing completely.
> 

[toc] | [prev] | [next] | [standalone]


#11890

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-06 23:23 -0700
Message-ID<6e3e86ab-8501-481a-a837-62e21cfa1a68@googlegroups.com>
In reply to#11889
Thank you very much again John, you're a dead set legend! I couldn't get the SWP_NOMOVE to work however, but your earlier work around will suffice. Thank you very much again :)

[toc] | [prev] | [next] | [standalone]


#11891

FromJohnMartens <martens@tennishulp.info>
Date2018-09-07 12:27 +0200
Message-ID<pmtjqm$29k$1@dont-email.me>
In reply to#11890
I got all the tricks from others in this NG

Goed to be able to give something back ....


Op 7-9-2018 om 08:23 schreef Jeff Rollo:
> Thank you very much again John, you're a dead set legend! I couldn't get the SWP_NOMOVE to work however, but your earlier work around will suffice. Thank you very much again :)
> 

[toc] | [prev] | [next] | [standalone]


#11892

From"Karl-Heinz" <invalid@invalid.invalid>
Date2018-09-07 12:38 +0200
Message-ID<fvf310Fh504U1@mid.individual.net>
In reply to#11890
Hi Jeff,

remove/deactivate the "move" item of the systemmenu. Than you don´t need 
that strange timer anymore.


Add to your window postinit():

LOCAL hSysMenu AS PTR

  hSysMenu := GetSystemMenu(SELF:Handle(0),FALSE)
  RemoveMenu(hSysMenu, SC_MOVE, MF_BYCOMMAND)


Let me know, if you´re still able to move the window.


regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#11894

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-07 17:36 -0700
Message-ID<8f794fca-c9a6-4fd4-a6bf-0c42c2c22cad@googlegroups.com>
In reply to#11892
Hi Karl, That's brilliant, thank you, although now the X etc in the top right corner is back...

[toc] | [prev] | [next] | [standalone]


#11895

From"Karl-Heinz" <invalid@invalid.invalid>
Date2018-09-09 11:42 +0200
Message-ID<fvk8c1FiqtsU1@mid.individual.net>
In reply to#11894
Hi Jeff,

>
> now the X etc in the top right corner is back
>


1. I think the best way is to remove the systemmenu of the Datawindow
completly. So, remove at first all current  calls concerning the "menu"
from your PostInit().

Then add these two lines:

   SELF:EnableSystemMenu(FALSE)
   SELF:EnableBorder(WINDOWNONSIZINGBORDER)



2. This method is needed that you can´t move the window, and that you can´t
close the datawindow with ALT+F4

METHOD Dispatch ( oEvent ) CLASS <yourwindow>
DO CASE

CASE oEvent:message == WM_NCLBUTTONDOWN

    IF oEvent:wparam == HTCAPTION

        // prevent a window move

        RETURN SELF:eventreturnvalue := 1L

    ENDIF


CASE oEvent:message == WM_SYSCOMMAND

    // prevent ALT + F4 closes the window

    IF oEvent:wparam == SC_CLOSE

        RETURN SELF:eventreturnvalue := 1L

    ENDIF


ENDCASE

RETURN SUPER:Dispatch ( oEvent )


3. Now it´s up to you to call EndWindow() somewhere in your Datawindow code,
otherwise the taskmanager will be your friend :-)

regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#11896

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-09 06:27 -0700
Message-ID<151d2df7-34d5-4026-8aea-9233c15c468c@googlegroups.com>
In reply to#11895
Brilliant Karl! Thank you very much. That's exactly what I needed.

[toc] | [prev] | [next] | [standalone]


#11897

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-09 06:34 -0700
Message-ID<07f420d1-9893-44ae-873f-c2e7e8a7b81b@googlegroups.com>
In reply to#11895
Brilliant Karl! Thank you very much. That's exactly what I needed. I just noticed though that if I click anywhere outside that window, it loses focus and is minimised to the taskbar. Can I stop it from doing that? Also, I'm NOT a lazy programmer, I really try to research my answers in help files BEFORE posting here. Is there some place I should bookmark? The VO Help system is useless in the cases I struggle with - like this one.....

[toc] | [prev] | [next] | [standalone]


#11898

From"Karl-Heinz" <invalid@invalid.invalid>
Date2018-09-10 07:37 +0200
Message-ID<fvmeccF1v7oU1@mid.individual.net>
In reply to#11897
Hi Jeff,

the window is not minimized, it´s just behind other windows.
To keep the window on top add this to your Postinit()


SetWindowPos( SELF:Handle(), HWND_TOPMOST, 0, 0, 0, 0, _OR (SWP_NOMOVE ,
SWP_NOSIZE))


regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#11899

FromJeff Rollo <jrollo64@gmail.com>
Date2018-09-09 23:31 -0700
Message-ID<85b59bcb-e075-4562-86d6-9bc9bfec7b7f@googlegroups.com>
In reply to#11898
Thanks so very much Karl, you're a genius! That's EXACTLY how I need it. Thanks again.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web