Page 1 of 1

Button a la derecha

PostPosted: Wed Jan 17, 2018 5:52 am
by Willi Quintana
Hola Amigos,
Usualmente, luego de definir una barra de botones (BUTTONBAR) en la ventana principal, luego defino los botones (BUTTON), y éstos empiezan por la izquierda hacia la derecha.
Ahora, como haría para tener un BUTTON al lado derecho la barra de botónes ?
Gracias
Image

Re: Button a la derecha

PostPosted: Wed Jan 17, 2018 11:33 am
by karinha

Re: Button a la derecha

PostPosted: Wed Jan 17, 2018 12:10 pm
by karinha
Code: Select all  Expand view

// C:\FWH..\SAMPLES\TESTBTNL.PRG

#include "Fivewin.ch"

PROCEDURE MAIN()

   Local oFont, oWnd, oBar, b1, b2, b3, b4, b5

   DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0,-10

   DEFINE WINDOW oWnd FROM 0,0 TO 474,639 PIXEL TITLE "Test"

   oWnd:SetFont(oFont)

   DEFINE BUTTONBAR oBar TOP _3D SIZE 80,80 OF oWnd

   DEFINE BUTTON RESOURCE "TOP"     TOP    PROMPT "Top"    NOBORDER OF oBar
   DEFINE BUTTON RESOURCE "LEFT"    LEFT   PROMPT "Left"   NOBORDER OF oBar
   DEFINE BUTTON RESOURCE "BOTTOM"  BOTTOM PROMPT "Bottom" NOBORDER OF oBar
   DEFINE BUTTON RESOURCE "RIGHT"   RIGHT  PROMPT "Right"  NOBORDER OF oBar
   DEFINE BUTTON RESOURCE "CENTER"  CENTER PROMPT "Center" NOBORDER OF oBar

   @10,500 BTNBMP RESOURCE "TOP"    TOP    PROMPT "DERECHA"    SIZE 70,70 OF oBar

   // @100,100 BTNBMP RESOURCE "TOP"    TOP    PROMPT "Top"    SIZE 80,80 OF oWnd

   /*
   @180, 20 BTNBMP RESOURCE "LEFT"   LEFT   PROMPT "Left"   SIZE 80,80 OF oWnd
   @260,100 BTNBMP RESOURCE "BOTTOM" BOTTOM PROMPT "Bottom" SIZE 80,80 OF oWnd
   @180,180 BTNBMP RESOURCE "RIGHT"  RIGHT  PROMPT "Right"  SIZE 80,80 OF oWnd
   @180,100 BTNBMP RESOURCE "CENTER" CENTER PROMPT "Center" SIZE 80,80 OF oWnd

   @100,400 BTNBMP b1 RESOURCE "TOP","","TOP0"       TOP    PROMPT "Top"    SIZE 80,80 OF oWnd
   @180,320 BTNBMP b2 RESOURCE "LEFT","","LEFT0"     LEFT   PROMPT "Left"   SIZE 80,80 OF oWnd
   @260,400 BTNBMP b3 RESOURCE "BOTTOM","","BOTTOM0" BOTTOM PROMPT "Bottom" SIZE 80,80 OF oWnd
   @180,480 BTNBMP b4 RESOURCE "RIGHT","","RIGHT0"   RIGHT  PROMPT "Right"  SIZE 80,80 OF oWnd
   @180,400 BTNBMP b5 RESOURCE "CENTER","","CENTER0" CENTER PROMPT "Center" SIZE 80,80 OF oWnd

   b1:Disable()
   b2:Disable()
   b3:Disable()
   b4:Disable()
   b5:Disable()
   */


   DEFINE MSGBAR OF oWnd PROMPT "Testing bitmaped buttons with captions" ;
      TIME DATE NOINSET

   ACTIVATE WINDOW oWnd

RETURN

procedure AppSys  // Xbase++ requirement

return
 


Image

Saludos.

Re: Button a la derecha

PostPosted: Wed Jan 17, 2018 2:40 pm
by mag071
Saludos ;
Añadir la clausula BTNRIGHT y el botón se te pone como en la imagen.

Ejemplo.:
Code: Select all  Expand view

         DEFINE BUTTON oBtns6 OF oBarMain PROMPT "Salir" ;
         FILE ".\imagenes\png\boton.png" BTNRIGHT FLAT
         oBtns6:bAction := { || oWndMain:End() }
         oBtns6:oCursor := oCursorHand
 

Re: Button a la derecha

PostPosted: Wed Jan 17, 2018 3:31 pm
by Rick Lipkin
Willi

I just create 'blank' buttons to add fill to my button bar .. Consider this code..

Rick Lipkin

Code: Select all  Expand view

DEFINE BUTTONBAR oBar OF oWind SIZE 80,64 2010
       oBar:SetColor( 0)                   // 45,40

   oBar:bClrGrad = { || { { 0.10,15724527,7303023 }, ;       // grey
       { 0.10,7303023,15724527 } } }

       DEFINE BUTTON oButt1 of oBar ACTION ( _CustOpen( "A",oWind ))  ;
              RESOURCE "customer" PROMPT "Clients-Billing" TOOLTIP "Clients and Billing"

       DEFINE BUTTON oButt2 of oBar ACTION (_Arview( "A",oWind )) ;
              RESOURCE "payment"     PROMPT "Receivables" TOOLTIP "Review Receivables"+CRLF+"Customer Statements"
                        // review //

       DEFINE BUTTON oButt3 of oBar ACTION ( _PayView( "A",oWind )) ;
              RESOURCE "cash"        PROMPT "Payments"    TOOLTIP "Payments and Adjustments"

       *   DEFINE BUTTON oButt4 of oBar ACTION nil
       *   DEFINE BUTTON oButt5 of oBar ACTION nil

       DEFINE BUTTON oButt7  of oBar ACTION ( nil )  // hide this ;
       DEFINE BUTTON oButt8  of oBar ACTION ( nil )  // hide this

       //--------  group --
       MENU oPopRpt POPUP
            MENUITEM "Customer Reports"  //RESOURCE "billing" ;
               MENU
               MENUITEM "Customer Listing Report" ACTION ( _CustList() )
               MENUITEM "Customer History Report" ACTION ( _CustHist() )
               MENUITEM "Customer Advertising and Publishing Report" ACTION ( _PubRpt() )
               ENDMENU
            MENUITEM "Accounts Receivable Reports"  //FileName (cDefa+"\Icons\FOLDERCLOSED.bmp");
               MENU
               MENUITEM "Customer Balance and Ageing Report" ACTION ( _ArAgeing())
               ENDMENU
            MENUITEM "Payment Reports"  // FileName (cDefa+"\Icons\FOLDERDETAIL.bmp");
               MENU
               MENUITEM "Payments and Adjustments Report" ACTION ( _PaymtRpt() )
               MENUITEM "Customer Pre-Payment Balances  " ACTION ( _PrePay() )
               ENDMENU
       ENDMENU

       DEFINE BUTTON oButt9 of oBar RESOURCE "report" ;
       MESSAGE "Reports" ;
       ACTION oButt9:ShowPopup();
       PROMPT "Reports" GROUP ;
       MENU oPopRpt
       oButt9:cToolTip := { " " + CRLF + "Reports", "Customer, Acct Rec and Payment Reports", 1, CLR_BLACK, 14089979  }

     ............
     ............
 


Image

Re: Button a la derecha

PostPosted: Thu Jan 18, 2018 1:53 am
by nageswaragunupudi
mag071 wrote:Saludos ;
Añadir la clausula BTNRIGHT y el botón se te pone como en la imagen.

Ejemplo.:
Code: Select all  Expand view

         DEFINE BUTTON oBtns6 OF oBarMain PROMPT "Salir" ;
         FILE ".\imagenes\png\boton.png" BTNRIGHT FLAT
         oBtns6:bAction := { || oWndMain:End() }
         oBtns6:oCursor := oCursorHand
 

BTNRIGHT clause is provided to display the button on the rightside of the bar.
FWH recommends use of BTNRIGHT clause.

Re: Button a la derecha

PostPosted: Thu Jan 18, 2018 4:59 pm
by Willi Quintana
Gracias nageswaragunupudi, la cláusula BTNRIGHT FLAT funcionó perfectamente
:D

Re: Button a la derecha

PostPosted: Fri Jan 19, 2018 7:06 pm
by jbrita
aca va otra.
DEFINE BUTTON oBtns[12] OF oBar RESOURCE "BAR_AYU" ;
TOOLTIP "Ayuda," + CRLF + "Indice y Contenido";
NOBORDER


oVentPrinc:bResized:={|| oBtns[12]:Move(2,oVentPrinc:nWidth()-35)}


Saludos