April 26, 2024, 08:48:58 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Quick little @topmost window question.

Started by mlwhitt, June 08, 2007, 08:36:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mlwhitt

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

Ionic Wind Support Team

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 ;)
Ionic Wind Support Team

Ionic Wind Support Team

Quick google search:

WS_EX_TOPMOST = 0x00000008

So try

ModifyExStyle win, 0 , 8
RedrawFrame win

Paul.
Ionic Wind Support Team

mlwhitt

Thanks so much as always Paul.  I appreciate it.

mlwhitt

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....

Parker

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 );

Ionic Wind Support Team

Right.  WS_EX_TOPMOST is one of those styles that can't be removed the normal way, forgot about that.

Paul.
Ionic Wind Support Team

mlwhitt

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?

LarryMc

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.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

mlwhitt

Thanks that worked, appreciate the help guys.