IonicWind Software

IWBasic => General Questions => Topic started by: mlwhitt on June 08, 2007, 08:36:58 AM

Title: Quick little @topmost window question.
Post by: mlwhitt on June 08, 2007, 08:36:58 AM
Most likely this is a stupid question but I have looked in the manual and can not find the answer I need.....

I have an application that I am currently using the @topmost switch to make my window stay on top always but I can not figure out what command to do if I make a button for the user to click to disable the @topmost feature.    In other words how can I turn the @topmost off after problem execution (during runtime).

Thanks,
Michael
Title: Re: Quick little @topmost window question.
Post by: Ionic Wind Support Team on June 08, 2007, 09:00:54 AM
Off of the top of my head...

Use ModifyExStyle with WS_EX_TOPMOST and then use RedrawFrame.

You'll need to search for the value of WS_EX_TOPMOST...I don't remember all of the window style values ;)
Title: Re: Quick little @topmost window question.
Post by: Ionic Wind Support Team on June 08, 2007, 09:04:54 AM
Quick google search:

WS_EX_TOPMOST = 0x00000008

So try

ModifyExStyle win, 0 , 8
RedrawFrame win

Paul.
Title: Re: Quick little @topmost window question.
Post by: mlwhitt on June 08, 2007, 09:15:55 AM
Thanks so much as always Paul.  I appreciate it.
Title: Re: Quick little @topmost window question.
Post by: mlwhitt on June 08, 2007, 11:44:23 AM
Me again...

I have tried the sample you gave me along with some other things and still having issues.

My windows is initialized as:

OpenWindow W1,0,0,580,620,@MINBOX|@MAXBOX|@TOPMOST|@SIZE,0,"FileApp",&main

So I am defaulting the application with being On Top.

I have a button set up that allows the user to click on it to change wither or not the program stays on top.  My logic is:
 

If they select the button to disable Always on top it runs the following code:

       ModifyExStyle w1, 0,8
       RedrawFrame w1

If they select the button to Enable Always on top it runs the following code:


      ModifyExStyle w1, 8,0
      RedrawFrame w1


Unfortunately no matter what happens the window continues to stay on top (as it was defaulted to during window init)


In addition to using the ModifyExStyle command I also tried the following:

  To turn on Always on Top:
     
           ModifyStyle @TopMost,0
           RedrawFrame w1

  To Turn off Always on Top:

          ModifyStyle 0,@TopMost
           RedrawFrame w1   

Neither way has worked, nor do I get any error messages or so forth.  If I place @TOPMOST in my OpenWindow statement then the window will always stay on top, else if I leave it out and default the window to normal then I am never able to set Always on Top after runtime.

Any ideas?

Thanks in advance....
Title: Re: Quick little @topmost window question.
Post by: Parker on June 08, 2007, 12:56:17 PM
I use this in Aurora:

SetWindowPos( m_hWnd, -1, 0, 0, 0, 0, 2 | 1 ); // sets the window to topmost

SetWindowPos( m_hWnd, -2, 0, 0, 0, 0, 2 | 1 ); // sets the window to not topmost

This is the declare:
import int SetWindowPos( unsigned int hwnd, int insertAfter, int x, int y, int cx, int cy, unsigned int flags );
Title: Re: Quick little @topmost window question.
Post by: Ionic Wind Support Team on June 08, 2007, 02:39:16 PM
Right.  WS_EX_TOPMOST is one of those styles that can't be removed the normal way, forgot about that.

Paul.
Title: Re: Quick little @topmost window question.
Post by: mlwhitt on June 08, 2007, 03:42:18 PM
Quote from: Parker on June 08, 2007, 12:56:17 PM
I use this in Aurora:

SetWindowPos( m_hWnd, -1, 0, 0, 0, 0, 2 | 1 ); // sets the window to topmost

SetWindowPos( m_hWnd, -2, 0, 0, 0, 0, 2 | 1 ); // sets the window to not topmost

This is the declare:
import int SetWindowPos( unsigned int hwnd, int insertAfter, int x, int y, int cx, int cy, unsigned int flags );


I have the Aurora compiler but I haven't had the time to learn it yet, any idea how that translates into EBasic?
Title: Re: Quick little @topmost window question.
Post by: LarryMc on June 08, 2007, 04:34:47 PM
declare:
declare extern SetWindowPos(int hwnd, int insertAfter, int x, int y, int cx, int cy, int flags ),int
Make topmost:
SetWindowPos( w1.hwnd, -1, 0, 0, 0, 0, 2 | 1 )
Make not topmost:
SetWindowPos( w1.hwnd, -2, 0, 0, 0, 0, 2 | 1 )
This worked for me.
Title: Re: Quick little @topmost window question.
Post by: mlwhitt on June 08, 2007, 04:43:33 PM
Thanks that worked, appreciate the help guys.