FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Como subir o bajar controles encimados
Posts: 408
Joined: Sun Aug 13, 2006 05:38 AM
Como subir o bajar controles encimados
Posted: Fri May 30, 2008 03:55 AM
¿como puedo cambiar el orden en la ventana de los controles?

Por ejemplo:
@ 1,1 say oSay1 prompt "UNO" of oWnd
@ 1,1 say oSay2 prompt "DOS" of oWnd

Lo que hace es mostrar "DOS", esto es oSay2 oculta a oSay1, lo que quiero es poder subir oSay1 y ocultar oSay2 y viceversa, no me funciona el ocultarlo, porque ese es un ejemplo, lo mas común es que queden traslapados, por ejemplo:
@ 1,1 say oSay1 prompt "UNO" of oWnd pixel
@ 5,15 say oSay2 prompt "DOS" of oWnd pixel

en este caso si oculto uno u otro no se ve la pequeña parte que muestra el de abajo
Saludos

Quique
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Como subir o bajar controles encimados
Posted: Fri May 30, 2008 11:18 AM

Quique,

No es necesario que les cambies el orden (zorder), lo resuelves usando la cláusula SIZE:

@ 1,1 say oSay1 prompt "UNO" of oWnd SIZE 80, 15 // por ejemplo

Prueba a cambiar el valor 15 por otros valores hasta que consigas las dimensiones deseadas

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 408
Joined: Sun Aug 13, 2006 05:38 AM
Como subir o bajar controles encimados
Posted: Fri May 30, 2008 03:00 PM
Antonio Linares wrote:Quique,

No es necesario que les cambies el orden (zorder), lo resuelves usando la cláusula SIZE:

@ 1,1 say oSay1 prompt "UNO" of oWnd SIZE 80, 15 // por ejemplo

Prueba a cambiar el valor 15 por otros valores hasta que consigas las dimensiones deseadas


Gracias Antonio, pero la idea no es cambiar el tamaño, simplemente que se vea el say que quiero ver, has de cuenta algo así
@ 1, 1 say oSay1 prompt "UNO" of oWnd pixel 
@ 5,15 say oSay2 prompt "DOS" of oWnd pixel

oSay1:lWantClick := .t.
oSay2:lWantClick := .t.

oSay1:bLClicked := { || subir( oSay1 ) }
oSay2:bLClicked := { || subir( oSay2 ) }


De esta manera esté el que esté arriba no tapa al de abajo, pero puedo ver el que quiero ver sin modificar tamaño o posición, icluso, puedo tener mas say encimados y subir al que se le de click
Saludos

Quique
Posts: 408
Joined: Sun Aug 13, 2006 05:38 AM
Como subir o bajar controles encimados
Posted: Tue Jun 03, 2008 01:02 AM
Antonio Linares wrote:Quique,

No es necesario que les cambies el orden (zorder), lo resuelves usando la cláusula SIZE:

¿Como puedo cambiar el zorder? o aunque sea ¿como puedo hacer que el siguiente control que se cree se coloque hasta arriba?
Saludos

Quique
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Como subir o bajar controles encimados
Posted: Tue Jun 03, 2008 07:55 AM
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:
#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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 408
Joined: Sun Aug 13, 2006 05:38 AM
Como subir o bajar controles encimados
Posted: Tue Jun 03, 2008 05:14 PM

Gracias, funciona

Saludos

Quique
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re:
Posted: Fri Jan 08, 2021 05:35 PM
Antonio Linares wrote: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 (fw): Select all Collapse
#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



Hola! Estoy probando este código ya que necesito mostrar unos controles que solapen a los que hay "debajo", con el say funciona bien, pero si ponemos por ejemplo un botón, al repintarlo "solapa" encima del control que debería estar en la posición superior. ¿Alguna idea?


Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Como subir o bajar controles encimados
Posted: Fri Jan 08, 2021 05:40 PM
Esto es lo que estoy realizando, la barra lateral es una simple BUTTONBAR a la que le cambio el tamaño y asigno captions al pulsar un botón.
Se puede observar claramente como el botón del diálogo "pringa" la buttonbar
* También he probado creando un TPanel en el que contener la buttonbar con idéntico resultado.

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Como subir o bajar controles encimados
Posted: Sat Jan 09, 2021 11:33 AM

Angel, envíame un ejemplo

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Como subir o bajar controles encimados
Posted: Sat Jan 09, 2021 12:09 PM

Enviado.

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4

Continue the discussion