Quique,
Aqui tienes un ejemplo de como cambiar el zorder de los controles. Fijate que la clave está en llamar a la función SetWindowPos() con unos determinados parámetros. Te adjunto la documentación de ese parámetro:
- Code: Select all Expand view
#include "FiveWin.ch"
#define HWND_TOP 0
#define HWND_BOTTOM 1
#define HWND_TOPMOST -1
#define HWND_NOTOPMOST -2
static oWnd, oBmp, oSay, oBrush
function Main()
DEFINE BRUSH oBrush STYLE 'TILED'
DEFINE WINDOW oWnd
@20, 30 BITMAP oBmp FILENAME '' SIZE 200, 200 PIXEL OF oWnd
oBmp:oBrush := oBrush
@50, 10 SAY oSay PROMPT 'Hola mundo' SIZE 100, 16 PIXEL OF oWnd ;
COLOR CLR_YELLOW, CLR_RED DESIGN
oSay:blDblClick := {|| Swap( oSay ) }
oBmp:blDblClick := {|| Swap( oBmp ) }
ACTIVATE WINDOW oWnd
return nil
function Swap( oCtrl )
LOCAL nOption := Alert( 'Posicion', { 'Top', 'Bottom' } )
LOCAL nWidth, nHeight
oCtrl:CoorsUpdate()
if oCtrl:ClassName() == 'TBITMAP'
nWidth := oCtrl:nRight - oCtrl:nLeft
nHeight := oCtrl:nBottom - oCtrl:nTop
else
nWidth := oCtrl:nWidth
nHeight := oCtrl:nHeight
endif
do case
case nOption == 1
SetWindowPos( oCtrl:hWnd, HWND_TOP , oCtrl:nTop, oCtrl:nLeft, nWidth, nHeight )
case nOption == 2
SetWindowPos( oCtrl:hWnd, HWND_BOTTOM, oCtrl:nTop, oCtrl:nLeft, nWidth, nHeight )
endcase
oCtrl:SetFocus()
return nil
hWndInsertAfter
Identifies the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values:
Value Meaning
HWND_BOTTOM Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
HWND_NOTOPMOST Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOP Places the window at the top of the Z order.
HWND_TOPMOST Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.