TOPMOST

TOPMOST

Postby Jimmy » Sat Nov 05, 2022 5:57 am

hi,

i want to create a Window which are "on TOP" of all other and will "stay" like MsgInfo()

---

in Help
Dialog
<nStyle> An optional DialogBox style.
There are several samples in the SAMPLES\ subdirectory showing you how to manipulate this value.

Windows:
<nStyle> A numeric value which indicates a special API style. [ Just for advanced FiveWin users.]

for "what" i have to search in \Sample Folder :?:

i do found "STYLE" Constant Sample for almost every other Control but not for Dialog or Window

---

there is Constant WS_EX_TOPMOST which can change Style but it have no Effect when use
Code: Select all  Expand view
STYLE WS_EX_TOPMOST


i also found this CODE
Code: Select all  Expand view
   SetWindowPos( oObj:hWnd, HWND_TOPMOST  ,;
                  oObj:nTop, oObj:nLeft    ,;
                  oObj:nWidth, oObj:nHeight )

which i can use at INIT

is there another "easy" Way which i do not know :?:
under HMG i "just" have to use Keyword TOPMOST
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: TOPMOST

Postby nageswaragunupudi » Sat Nov 05, 2022 8:29 am

i also found this CODE
Code:
SetWindowPos( oObj:hWnd, HWND_TOPMOST ,;
oObj:nTop, oObj:nLeft ,;
oObj:nWidth, oObj:nHeight )

which i can use at INIT

Is this working as expected?

Can this be useful?
Code: Select all  Expand view
SetForegroundWindow( oWnd:hWnd
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TOPMOST

Postby nageswaragunupudi » Sat Nov 05, 2022 8:31 am

under HMG i "just" have to use Keyword TOPMOST

Can we see the full code sample for creation of Top window in HMG syntax?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TOPMOST

Postby Jimmy » Sat Nov 05, 2022 8:56 am

hi,
nageswaragunupudi wrote:
Can we see the full code sample for creation of Top window in HMG syntax?

my work Sample
Code: Select all  Expand view
  DEFINE WINDOW ASKFORM ;
         AT 0, 0 ;
         WIDTH 534 HEIGHT 270 ;
         TITLE cAction ;
         ICON "A1MAIN" ;
         TOPMOST ;
         NOMINIMIZE ;
         NOMAXIMIZE ;
         NOSIZE ;
         BACKCOLOR SP_nColor1()



Code: Select all  Expand view
Standard Syntax (xBase Style):

 

 

      DEFINE WINDOW <WindowName>

            AT <nRow> ,<nCol>

            WIDTH <nWindth>

            HEIGHT <nHeight>

            [ VIRTUAL WIDTH <nVirtualWindth> ]

            [ VIRTUAL HEIGHT <nVirtualHeight> ]

            [ TITLE <cTitle> ]

            [ ICON <cIconName> ]

            [ MAIN | CHILD | MODAL | SPLITCHILD | PANEL ]

            [ NOSHOW ]

            [ TOPMOST ]

            [ NOAUTORELEASE ]

            [ NOMINIMIZE ]

            [ NOMAXIMIZE ]

            [ NOSIZE ]

            [ NOSYSMENU ]

            [ NOCAPTION ]

            [ CURSOR <CursorName> ]

            [ ON INIT <InitProcedureName> | <bBlock> ]

            [ ON RELEASE <ReleaseProcedureName> | <bBlock> ]

            [ ON INTERACTIVECLOSE <InteractiveCloseProcedureName> | <bBlock> ]

            [ ON MOUSECLICK <MouseClickProcedureName> | <bBlock> ]

            [ ON MOUSEDRAG <MouseDragProcedureName> | <bBlock> ]

            [ ON MOUSEMOVE <MouseMoveProcedureName> | <bBlock> ]

            [ ON SIZE <WindowSizeProcedureName> | <bBlock> ]

            [ ON MAXIMIZE <WindowMaximizeProcedureName>  | <bBlock> ]

            [ ON MINIMIZE <WindowMinimizeProcedureName>  | <bBlock> ]

            [ ON PAINT<WindowPaintProcedureName>  | <bBlock> ]

            [ BACKCOLOR <anBackColor> ]

            [ FONT <cFontName> SIZE <nFontSize> ]

            [ NOTIFYICON <cNotifyIconName> ]

            [ NOTIFYTOOLTIP <cNotifyTooltip> ]

            [ ON NOTIFYCLICK <NotifyClickProcedure> | <bBlock> ]

            [ ON GOTFOCUS <ProcedureName> | <bBlock> ]

            [ ON LOSTFOCUS <ProcedureName> | <bBlock> ]

            [ ON SCROLLUP <ProcedureName> | <bBlock> ]

            [ ON SCROLLDOWN <ProcedureName> | <bBlock> ]

            [ ON SCROLLLEFT <ProcedureName> | <bBlock> ]

            [ ON SCROLLRIGHT <ProcedureName> | <bBlock> ]

            [ ON HSCROLLBOX <ProcedureName> | <bBlock> ]

            [ ON VSCROLLBOX <ProcedureName> | <bBlock> ]

            [ HELPBUTTON ]

            [ GRIPPERTEXT <cGripperText> ]

            [ BREAK ]

            [ FOCUSED ]

 

            ... Control Definitions...

 

      END WINDOW

 

 

Alternate Syntax:

 

 

      DEFINE WINDOW <WindowName>

            ROW <nRow>

            COL <nCol>

            WIDTH <nWindth>

            HEIGHT <nHeight>

            WINDOWTYPE MAIN | CHILD | MODAL | SPLITCHILD | STANDARD | PANEL

            [ VIRTUALWIDTH <nVirtualWindth> ]

            [ VIRTUALHEIGHT <nVirtualHeight> ]

            [ TITLE <cTitle> ]

            [ ICON <cIconName> ]

            [ VISIBLE <lValue> ]

            [ TOPMOST [<lValue>] ]

            [ AUTORELEASE <lValue> ]

            [ MINBUTTON <lvalue> ]

            [ MAXBUTTON <lValue> ]

            [ SIZABLE <lValue> ]

            [ SYSMENU <lValue> ]

            [ TITLEBAR <lValue> ]

            [ CURSOR <CursorName> ]

            [ ONINIT <InitProcedureName> | <bBlock> ]

            [ ONRELEASE <ReleaseProcedureName> | <bBlock> ]

            [ ONINTERACTIVECLOSE <InteractiveCloseProcedureName> | <bBlock> ]

            [ ONMOUSECLICK <MouseClickProcedureName> | <bBlock> ]

            [ ONMOUSEDRAG <MouseDragProcedureName> | <bBlock> ]

            [ ONMOUSEMOVE <MouseMoveProcedureName> | <bBlock> ]

            [ ONSIZE <WindowSizeProcedureName> | <bBlock> ]

            [ ONMAXIMIZE <WindowMaximizeProcedureName>  | <bBlock> ]

            [ ONMINIMIZE <WindowMinimizeProcedureName>  | <bBlock> ]

            [ ONPAINT<WindowPaintProcedureName>  | <bBlock> ]

            [ BACKCOLOR <anBackColor> ]

            [ FONTNAME <cFontName> FONTSIZE <nFontSize> ]

            [ NOTIFYICON <cNotifyIconName> ]

            [ NOTIFYTOOLTIP <cNotifyTooltip> ]

            [ ONNOTIFYCLICK <NotifyClickProcedure> | <bBlock> ]

            [ ONGOTFOCUS <ProcedureName> | <bBlock> ]

            [ ONLOSTFOCUS <ProcedureName> | <bBlock> ]

            [ ONSCROLLUP <ProcedureName> | <bBlock> ]

            [ ONSCROLLDOWN <ProcedureName> | <bBlock> ]

            [ ONSCROLLLEFT <ProcedureName> | <bBlock> ]

            [ ONSCROLLRIGHT <ProcedureName> | <bBlock> ]

            [ ONHSCROLLBOX <ProcedureName> | <bBlock> ]

            [ ONVSCROLLBOX <ProcedureName> | <bBlock> ]

            [ HELPBUTTON <lValue> ]

            [ GRIPPERTEXT <cGripperText> ]

            [ BREAK lValue ]

            [ FOCUSED <lValue> ]

 

            ... Control Definitions...

 

      END WINDOW

 

 

Focused, Break and GripperText properties are available only for 'SplitChild' type windows.

Topmost property is not available for modal and splitchild type windows.

 

 

Properties:

 

- Row

- Col

- Width

- Height

- Title

- NotifyIcon

- NotifyTooltip

- FocusedControl (R)

- Cursor (W)

- VirtualWidth (D)

- VirtualHeight (D)

- Icon (R)

- WindowType (D)

- Visible (D)

- AutoRelease (D)

- MinButton (D)

- MaxButton (D)

- Sizable (D)

- SysMenu (D)

- TitleBar (D)

- BackColor (D)

- FontName (D)

- FontSize (D)

- HelpButton (D)

- GripperText (D)

- Break (D)

- Focused (D)

- Topmost (D)

- Name (R)

 

 

(R) Read-Only (available after control definition via GetProperty function or semi-oop syntax)

(W) Write-Only (available after control definition via SetProperty function or semi-oop syntax)

(D) Available at definition only

 

Properties not tagged are available for read and write after control definition via SetProperty and GetProperty functions or semi-oop syntax.

 

 

Methods:

 

- Capture

- Print

- Show

- Hide

- Center

- Maximize

- Minimize

- Activate

- Restore

- Release

- SetFocus

 

 

Window Events:

 

-    OnInit

-    OnRelease

-    OnInteractiveClose

-    OnMouseClick

-    OnMouseDrag

-    OnMouseMove

-    OnSize

-    OnMaximize

-    OnMinimize

-    OnPaint

-    OnNotifyClick

-    OnGotFocus

-    OnLostFocus

-    OnScrollUp

-    OnScrollDown

-    OnScrollLeft

-    OnScrollRight

-    OnHscrollBox

-    OnVscrollBox

 

 

New Properties:

 

 

ThisWindow|<FormName>.Handle            --> nFormHandle

ThisWindow|<FormName>.Index             --> nFormIndex

ThisWindow|<FormName>.IsMinimized       --> lBoolean

ThisWindow|<FormName>.IsMaximized       --> lBoolean

ThisWindow|<FormName>.ClientAreaWidth   --> nWidth

ThisWindow|<FormName>.ClientAreaHeight  --> nHeight

 

ThisWindow|<FormName>.NoCaption   [ := | --> ] lBoolean

ThisWindow|<FormName>.NoMaximize  [ := | --> ] lBoolean

ThisWindow|<FormName>.NoMinimize  [ := | --> ] lBoolean

ThisWindow|<FormName>.NoClose     [ := | --> ] lBoolean

ThisWindow|<FormName>.NoSize      [ := | --> ] lBoolean

ThisWindow|<FormName>.NoSysMenu   [ := | --> ] lBoolean

ThisWindow|<FormName>.HScroll     [ := | --> ] lBoolean

ThisWindow|<FormName>.VScroll     [ := | --> ] lBoolean

ThisWindow|<FormName>.Enabled     [ := | --> ] lBoolean

 

ThisWindow|<FormName>.AlphaBlendTransparent := nAlphaBlend (0 to 255, Completely Transparent = 0, Opaque = 255)

ThisWindow|<FormName>.BackColorTransparent  := aRGBColor

 

ThisWindow|<FormName>.CenterWorkArea

ThisWindow|<FormName>.CenterIn ( FormName2 )

 

CENTER WINDOW <FormName> DESKTOP

CENTER WINDOW <FormName> IN <FormName2>

 

 

 

 

Visual Effects on Windows:

 

 

-    SET WINDOW FormName TRANSPARENT TO COLOR aRGBColor

-    SET WINDOW FormName TRANSPARENT TO nAlphaBlend  --> nAlphaBlend = 0 to 255 (completely transparent = 0, opaque = 255)

-    SET WINDOW FormName [ TRANSPARENT ] TO OPAQUE

 

 

-    FLASH WINDOW FormName CAPTION COUNT nTimes INTERVAL nMilliseconds

-    FLASH WINDOW FormName TASKBAR COUNT nTimes INTERVAL nMilliseconds

-    FLASH WINDOW FormName [ ALL ] COUNT nTimes INTERVAL nMilliseconds

 

 

-    ANIMATE WINDOW FormName INTERVAL nMilliseconds MODE nFlags

-    ANIMATE WINDOW FormName MODE nFlags

 

- MODE <nFlags> (see the function AnimateWindow() in the API Window Reference), constants defined in i_Window.ch

 

#define AW_HOR_POSITIVE 0x00000001

#define AW_HOR_NEGATIVE 0x00000002

#define AW_VER_POSITIVE 0x00000004

#define AW_VER_NEGATIVE 0x00000008

#define AW_CENTER       0x00000010

#define AW_HIDE         0x00010000

#define AW_ACTIVATE     0x00020000

#define AW_SLIDE        0x00040000

#define AW_BLEND        0x00080000


Code: Select all  Expand view

HB_FUNC ( INITWINDOW )
{
   HWND hwnd;
   int Style = WS_POPUP;
   int ExStyle = 0;

   if ( hb_parl (16) )
      ExStyle = WS_EX_CONTEXTHELP ;
   else
   {
      ExStyle = 0 ;
      if ( ! hb_parl (6) )
         Style = Style | WS_MINIMIZEBOX ;

      if ( ! hb_parl (7) )
         Style = Style | WS_MAXIMIZEBOX ;
   }

   if ( ! hb_parl (8) )
      Style = Style | WS_SIZEBOX ;

   if ( ! hb_parl (9) )
      Style = Style | WS_SYSMENU ;

   if ( ! hb_parl (10) )
      Style = Style | WS_CAPTION ;

   if ( hb_parl (11) )
      ExStyle = ExStyle | WS_EX_TOPMOST ;

   if ( hb_parl (14) )
      Style = Style | WS_VSCROLL ;

   if ( hb_parl (15) )
      Style = Style | WS_HSCROLL ;

   if ( hb_parl (17) ) // Panel
   {
      Style = WS_CHILD ;
      ExStyle = ExStyle | WS_EX_CONTROLPARENT | WS_EX_STATICEDGE ;
   }


   hwnd = CreateWindowEx ( ExStyle , HMG_parc(12) ,
                           HMG_parc(1), Style ,
                           hb_parni(2),
                           hb_parni(3),
                           hb_parni(4),
                           hb_parni(5),
                           (HWND) HMG_parnl (13),
                           (HMENU) NULL,
                           GetModuleHandle( NULL ),
                           NULL);

   if (hwnd == NULL)
   {
      MessageBox(0, _TEXT("Window Creation Failed!"), _TEXT("Error!"),
      MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
      return;
   }

   HMG_retnl ((LONG_PTR) hwnd );
}
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: TOPMOST

Postby nageswaragunupudi » Sat Nov 05, 2022 9:02 am

Thanks
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TOPMOST

Postby Enrico Maria Giordano » Sat Nov 05, 2022 9:29 am

Please don't bloat the already big TWindow class. :-)
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: TOPMOST

Postby Jimmy » Sat Nov 05, 2022 10:00 am

nageswaragunupudi wrote:
i also found this CODE
Code:
SetWindowPos( oObj:hWnd, HWND_TOPMOST ,;
oObj:nTop, oObj:nLeft ,;
oObj:nWidth, oObj:nHeight )

which i can use at INIT

Is this working as expected?

YES :D

nageswaragunupudi wrote:Can this be useful?
Code: Select all  Expand view
SetForegroundWindow( oWnd:hWnd

NO.
it will come to foreground but User can click on "MAIN" so it will "disappear" behind
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: TOPMOST

Postby Enrico Maria Giordano » Sat Nov 05, 2022 10:02 am

Try this:

Code: Select all  Expand view
FUNCTION ONTOP( oWnd )

    SETWINDOWPOS( oWnd:hWnd, -1, 0, 0, 0, 0, 3 )

    RETURN NIL
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 27 guests