ACERCA DE BTNBMP FLAT [DESCARTADO]

ACERCA DE BTNBMP FLAT [DESCARTADO]

Postby Ramón J. » Mon May 23, 2022 7:30 am

Hola a todos

Hace tiempo solicité ayuda de cómo colocar botones en la pantalla principal y seguí las recomendaciones de Mr. Rao en este post, con BTNBMP PROMPT "Button" SIZE 150,80 PIXEL OF oWnd FLAT:

https://forums.fivetechsupport.com/viewtopic.php?f=6&t=40860&start=0&sid=880b3cc08da3e2febbc109927e09277e

Al ver el funcionamiento de la aplicación en otro puesto que tenía el monitor con mayor resolución vi que, si bien el logo se mantenía centrado, los botones se desplazaban llegando a montarse sobre el logo.

Por ejemplo, en monitor con resolución 1360x768:
Image
En un monitor con mayor resolución:

Image

¿Hay alguna forma de que no desplacen, como ocurre con el logo?

Saludos
Last edited by Ramón J. on Fri May 27, 2022 8:08 pm, edited 1 time in total.
FWH 20.12 BCC7
Ramón J.
 
Posts: 152
Joined: Mon Feb 13, 2006 8:23 pm

Re: ACERCA DE BTNBMP FLAT

Postby Antonio Linares » Mon May 23, 2022 7:33 am

Puedes copiar aqui el código que usas para dibujar el logo y los botones ?

gracias
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ACERCA DE BTNBMP FLAT

Postby Ramón J. » Mon May 23, 2022 10:07 am

Hola, Antonio

El código de los botones es este:

Code: Select all  Expand view
cLogo:=alltrim(cruta)+"\BITMAPS\LOGO.png" // Logo central de la pantalla principal

DEFINE BRUSH oBrush COLOR RGB(255,255,255)       // Fondo blanco

DEFINE WINDOW oWnd FROM 4, 4 TO 25, 75  TITLE "Registro de SAT";
   MENU BuildMenu(cRuta,crutatemp);
    BRUSH oBrush    
//   MDI VSCROLL;    

@ 500, 400 BTNBMP oBmp1 PROMPT "Registro de documentos" SIZE 150,50 PIXEL OF oWnd;
    FLAT Tooltip "Acceso al registro de documentos"  ACTION (msgrun(,,,,),Registro(cRuta))

obmp1:cTooltip :={ "Acceso al registro general de documentos", ;
                     "SAT", 1, CLR_WHITE, CLR_CYAN }  

@ 500, 600 BTNBMP oBmp2 PROMPT "Búsqueda por denominación del  SAT" SIZE 150,50 PIXEL OF oWnd;
    FLAT Tooltip "Búsqueda por letras o palabras" ACTION Clients(cRuta, crutatemp)

obmp2:cTooltip :={ "Búsqueda por denominación del SAT", ;
                     "SAT", 1, CLR_WHITE, CLR_CYAN }
 
@ 500, 800 BTNBMP oBmp3 PROMPT "Introducción número de registro SAT" SIZE 150,50 PIXEL OF oWnd;
   FLAT Tooltip "Búsqueda por número de registro SAT" ACTION Clientsat(cRuta)
 
obmp3:cTooltip :={ "Búsqueda por introducción del número de registro del SAT", ;
                     "SAT", 1, CLR_WHITE, CLR_CYAN }    
                           
 oWnd:bPainted := { || oWnd:DrawImage( cLogo ) }  

 ACTIVATE WINDOW oWnd MAXIMIZED
   
return nil


Un saludo
FWH 20.12 BCC7
Ramón J.
 
Posts: 152
Joined: Mon Feb 13, 2006 8:23 pm

Re: ACERCA DE BTNBMP FLAT

Postby Ramón J. » Wed May 25, 2022 6:26 am

Buenos días, Antonio

Aprovechando el código de otro post, que ya está solucionado, te pongo el siguiente para que lo compiles y lo compruebes. Mi monitor, que es 24', esta en una resolución de 1366x768 y aquí se ve el logo centrado y los botones debajo del logo también alineados.

Si el monitor lo configuras con parámetros diferentes, el logo sigue estando centrado, pero los botones ya se mueven. Por ejemplo pones, el monitor a 1920x1080, que es el recomendado por la mayoría de los monitores (para mi gusto está todo muy pequeño), el logo se mantiene centrado, pero los botones se montan sobre el logo.

El código para que lo compiles y lo pruebes es este:

Code: Select all  Expand view
#include 'fivewin.ch'

//-----------------------------TESTING BTNBMP FLAT -----------------------------------------------//

function Main()
 
  local oWnd, oBrush, cLogo, oFont, oBtn1, oBtn2, oBtn3, oBtn4, oBtn5
 

   SetBalloon( .T. )
 
   cLogo:="C:\FWH\BITMAPS\fivewin.bmp"
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
 
  DEFINE BRUSH oBrush COLOR RGB(255,255,255)
 
  DEFINE WINDOW oWnd FROM 4, 4 TO 25, 75  TITLE "Testing buttons BTNBMP FLAT"

             
   @ 500, 200 BTNBMP oBtn1 PROMPT "&New" SIZE 150, 50 OF oWnd FLAT FONT oFont ACTION MsgInfo("New")
   @ 500, 400 BTNBMP oBtn2 PROMPT "&Edit" SIZE 150, 50 OF oWnd FLAT FONT oFont ACTION MsgInfo("Edit")
   @ 500, 600 BTNBMP oBtn3 PROMPT "&Delete" SIZE 150, 50 OF oWnd FLAT FONT oFont ACTION MsgInfo("Delete")
   @ 500, 800 BTNBMP oBtn4 PROMPT "&Print" SIZE 150, 50 OF oWnd FLAT FONT oFont ACTION MsgInfo("Print")
   @ 500,1000 BTNBMP oBtn5 PROMPT "&Bye" SIZE 150, 50 OF oWnd FLAT FONT oFont ACTION (MsgInfo("Exit"),oWnd:End())

   oBtn1:cTooltip:="New"
   oBtn2:cTooltip:="Edit"
   oBtn3:cTooltip:="Delete"
   oBtn4:cTooltip:="Print"
   oBtn5:cTooltip:="Exit"

    oWnd:bPainted := { || oWnd:DrawImage( cLogo ) }  

   ACTIVATE WINDOW oWnd MAXIMIZED
   
   RELEASE oFont

RETURN nil
 


Saludos
FWH 20.12 BCC7
Ramón J.
 
Posts: 152
Joined: Mon Feb 13, 2006 8:23 pm

Re: ACERCA DE BTNBMP FLAT

Postby nageswaragunupudi » Fri May 27, 2022 11:13 am

Code: Select all  Expand view
oWnd:DrawImage( cLogo )

By default, this will always centers the image in the Window.

But you have created the buttons with absolute coordinates in pixel.
If you want them to be move in relation to the size of the window, you need to recalculating the coordinates relative to the screen size, in oWnd:bResized code block.
Regards

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

Re: ACERCA DE BTNBMP FLAT

Postby Ramón J. » Fri May 27, 2022 8:07 pm

Thank you Mr Rao

It is not worth the work of recalculating all the possible coordinates for only three buttons that are not very important. I'm going to remove them.

Regards
FWH 20.12 BCC7
Ramón J.
 
Posts: 152
Joined: Mon Feb 13, 2006 8:23 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 86 guests