lose focus on buttonbar

lose focus on buttonbar

Postby Silvio.Falconi » Thu Apr 27, 2023 9:22 am

i have a simple dialog with a buttonbar and 8 buttons
initially only the first 6 buttons are shown
if the user changes the buttonbar type it must show only two buttons
if the user restores the initial buttonbar he must put back the 6 buttons

when the buttonbar type changes it loses the focus and colors of the buttonbar

this is the test

Code: Select all  Expand view  RUN

#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"



Function test()
   local oDlg,oDbf,oFont
   local oBar,aBtnBar:=array(8)

   local  nBottom   := 27.2
   local  nRight    := 89
   local  nWd       := Max( nRight * DLG_CHARPIX_W, 180 )
   local  nHt       := nBottom * DLG_CHARPIX_H

 DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
         TiTle "test"

   @ 90,10 Button "Second bar" size 100,18 PIXEL OF oDlg action Btnbar(2,oBar,aBtnBar,oDlg)
   @ 90,200 Button "First bar" size 100,18 PIXEL OF oDlg action Btnbar(1,oBar,aBtnBar,oDlg)

   ACTIVATE DIALOG oDlg  CENTER   ;
          ON INIT Btnbar(1,oBar,aBtnBar,oDlg)
RETURN NIL
//--------------------------------------------------------//
Function Btnbar(nBar,oBar,aBtnBar,oDlg)
  DEFINE BUTTONBAR oBar OF oDlg  SIZE 80,70  TOP NOBORDER  2015


  Do case
  case nbar =1



   DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New"
   DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify"
   DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate"
   DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del"
   DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print"
   DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help"
   DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del"
   DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print"

    aBtnBar[7]:hide()
    aBtnBar[8]:hide()

 case nbar = 2

   aBtnBar[1]:hide()
   aBtnBar[2]:hide()
   aBtnBar[3]:hide()
   aBtnBar[4]:hide()
   aBtnBar[5]:hide()
   aBtnBar[6]:hide()

     DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del" action msginfo()
     DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print" action msginfo()

     aBtnBar[7]:show()
    aBtnBar[8]:show()

  endcase



  return nil






 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lose focus on buttonbar

Postby karinha » Thu Apr 27, 2023 11:20 am

Aqui funciona perfecto!

Code: Select all  Expand view  RUN

// Idea Original by Silvio Falconi.
// C:\FWH..\SAMPLES\SILBTNFO.PRG - Modificado en: 27/04/2023 - Joao.

#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"

#Define aPubGrad {| lInvert | If( lInvert, ;
                 { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                 { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
                 },                                                         ;
                 { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
                 { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
                 } ) }

STATIC oFont

FUNCTION Main() // Ejemplo original by Silvio Falconi.

   LOCAL oDlg, oDbf, cTitle, oBar, aBtnBar := ARRAY(8), cSay, oSay, oFont2
   LOCAL  nBottom := 27.2
   LOCAL  nRight  := 89
   LOCAL  nWd     := Max( nRight * DLG_CHARPIX_W, 180 )  // 703.10
   LOCAL  nHt     := nBottom * DLG_CHARPIX_H             // 410.72

   SKinButtons()

   cSay   := OemToAnsi( "I LOVE FIVEWIN THE BEST!"              )
   cTitle := OemToAnsi( "oBar: Perde o Foco na Barra de Botäes" )

   DEFINE FONT oFont  NAME "Segoe UI Light" SIZE 0, -16 BOLD
   DEFINE FONT oFont2 NAME "Segoe UI Light" SIZE 0, -28 BOLD

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL TITLE cTitle ;
      COLORS CLR_BLACK, CLR_WHITE TRANSPARENT FONT oFont

   oDlg:lHelpIcon := .F.

   @ 200, 150 SAY oSay VAR cSay SIZE 400, 100 PIXEL OF oDlg UPDATE CENTER ;
      FONT oFont2 COLOR CLR_CYAN, CLR_BLACK

   @ 90, 50 BUTTON "2-Second bar" SIZE 120, 40 PIXEL OF oDlg     ;
      ACTION Btnbar( 2, oBar, aBtnBar, oDlg ) DEFAULT

   @ 90, 200 BUTTON "1-First bar" SIZE 120, 40 PIXEL OF oDlg     ;
      ACTION Btnbar( 1, oBar, aBtnBar, oDlg )

   @ 90, 340 BUTTON "0 &All" SIZE 080, 40 PIXEL OF oDlg          ;
      ACTION Btnbar( 0, oBar, aBtnBar, oDlg )

   @ 90, 450 BUTTON "&Exit" SIZE 080, 40 PIXEL OF oDlg           ;
      ACTION( oDlg:End() ) CANCEL

   ACTIVATE DIALOG oDlg CENTER ON INIT( BtnBar( 0, oBar, aBtnBar, oDlg ) )

   oFont:End()
   oFont2:End()

RETURN NIL

FUNCTION BtnBar( nBar, oBar, aBtnBar, oDlg )

   DEFINE BUTTONBAR oBar BUTTONSIZE 70, 50 _3DLOOK TOP OF oDlg 2007

   WITH OBJECT oBar

      oBar:bClrGrad := aPubGrad

      oBar:bRClicked := { || NIL }
      oBar:bLClicked := { || NIL }

      oBar:SetFont( oFont )

      oBar:nClrText := CLR_HBLUE

      oBar:Adjust()

   END

   DO CASE

   CASE nBar = 0 // muestra todo.

      DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New 1"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"

      DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify 2" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\floppy.bmp"

      DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplic 3" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\HelpInd.bmp"

      DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del 4"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"

      DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print 5"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp"

      DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help 6"   NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\Help.bmp"

      DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del 7"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"

      DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print 8"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp"

      aBtnBar[7]:Show()
      aBtnBar[8]:Show()

      aBtnBar[7]:Refresh()
      aBtnBar[8]:Refresh()

   CASE nBar = 1  // muestra de 1 a 6

      DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New 1"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"

      DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify 2" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\floppy.bmp"

      DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplic 3" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\HelpInd.bmp"

      DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del 4"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"

      DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print 5"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp"

      DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help 6"   NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\Help.bmp"

      DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del 7"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"

      DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print 8"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp"

      aBtnBar[7]:Hide()
      aBtnBar[8]:Hide()

      aBtnBar[7]:Refresh()
      aBtnBar[8]:Refresh()

   CASE nBar = 2  // muestra 7 y 8

      DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New 1"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"

      DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify 2" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\floppy.bmp"

      DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplic 3" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\HelpInd.bmp"

      DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del 4"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"

      DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print 5"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp"

      DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help 6"   NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\Help.bmp"

      DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del 7"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"

      DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print 8"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp"

      aBtnBar[1]:Hide()
      aBtnBar[2]:Hide()
      aBtnBar[3]:Hide()
      aBtnBar[4]:Hide()
      aBtnBar[5]:Hide()
      aBtnBar[6]:Hide()

      aBtnBar[1]:Refresh()
      aBtnBar[2]:Refresh()
      aBtnBar[3]:Refresh()
      aBtnBar[4]:Refresh()
      aBtnBar[5]:Refresh()
      aBtnBar[6]:Refresh()

      aBtnBar[7]:Show()
      aBtnBar[8]:Show()

      aBtnBar[7]:Refresh()
      aBtnBar[8]:Refresh()

   ENDCASE

RETURN NIL

// FIN / END  - kapiabafwh@gmail.com
 


Rerads, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: lose focus on buttonbar

Postby karinha » Thu Apr 27, 2023 11:24 am

https://imgur.com/Yc1pjg2

WOW()

Image

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: lose focus on buttonbar

Postby Silvio.Falconi » Thu Apr 27, 2023 12:39 pm

there is a problem
I not want hide or show the buttons ( when the use move the mouse into there are also the buttons)

I wish as there are 2 buttonbar different

at init there are 6 buttons

1) "New"
2) "Modify"
3) "Duplicate"
4) "Del"
5) "Print"
6) "Help"



if press the user there are only the 4 and the 5

1) "Del"
2) "Print"
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lose focus on buttonbar

Postby karinha » Thu Apr 27, 2023 12:52 pm

No puedo entender la traducción. El traductor de Google es terrible.

I can't understand the translation. Google translator is terrible.

You have the SOURCE there, modify it to taste.

Ahí tienes la FUENTE, modifícala al gusto.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: lose focus on buttonbar

Postby karinha » Thu Apr 27, 2023 12:58 pm

I understood! When the user MOVES THE MOUSE, the buttons reappear.

¡Entendí! Cuando el usuario MUEVE EL RATÓN, los botones vuelven a aparecer.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: lose focus on buttonbar

Postby karinha » Thu Apr 27, 2023 1:16 pm

Pronto Silvio: I LOVE FIVEWIN The Best!

Code: Select all  Expand view  RUN

// Idea Original by Silvio Falconi.
// C:\FWH..\SAMPLES\SILBTNFO.PRG - Modificado en: 27/04/2023 - Joao.

#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"

#Define aPubGrad {| lInvert | If( lInvert, ;
                 { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                 { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
                 },                                                         ;
                 { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
                 { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
                 } ) }

// controle de Botones.
STATIC oFont, lLigaBtn1 := .T., lLigaBtn2 := .T., lLigaBtn3 := .T., ;
              lLigaBtn4 := .T., lLigaBtn5 := .T., lLigaBtn6 := .T., ;
              lLigaBtn7 := .T., lLigaBtn8 := .T.

FUNCTION Main() // Ejemplo original by Silvio Falconi.

   LOCAL oDlg, oDbf, cTitle, oBar, aBtnBar := ARRAY(8), cSay, oSay, oFont2
   LOCAL  nBottom := 27.2
   LOCAL  nRight  := 89
   LOCAL  nWd     := Max( nRight * DLG_CHARPIX_W, 180 )  // 703.10
   LOCAL  nHt     := nBottom * DLG_CHARPIX_H             // 410.72

   SKinButtons()

   cSay   := OemToAnsi( "I LOVE FIVEWIN THE BEST!"              )
   cTitle := OemToAnsi( "oBar: Perde o Foco na Barra de Botäes" )

   DEFINE FONT oFont  NAME "Segoe UI Light" SIZE 0, -16 BOLD
   DEFINE FONT oFont2 NAME "Segoe UI Light" SIZE 0, -28 BOLD

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL TITLE cTitle ;
      COLORS CLR_BLACK, CLR_WHITE TRANSPARENT FONT oFont

   oDlg:lHelpIcon := .F.

   @ 200, 150 SAY oSay VAR cSay SIZE 400, 100 PIXEL OF oDlg UPDATE CENTER ;
      FONT oFont2 COLOR CLR_CYAN, CLR_BLACK

   @ 90, 50 BUTTON "2-Second bar" SIZE 120, 40 PIXEL OF oDlg     ;
      ACTION Btnbar( 2, oBar, aBtnBar, oDlg ) DEFAULT

   @ 90, 200 BUTTON "1-First bar" SIZE 120, 40 PIXEL OF oDlg     ;
      ACTION Btnbar( 1, oBar, aBtnBar, oDlg )

   @ 90, 340 BUTTON "0 &All" SIZE 080, 40 PIXEL OF oDlg          ;
      ACTION Btnbar( 0, oBar, aBtnBar, oDlg )

   @ 90, 450 BUTTON "&Exit" SIZE 080, 40 PIXEL OF oDlg           ;
      ACTION( oDlg:End() ) CANCEL

   ACTIVATE DIALOG oDlg CENTER ON INIT( BtnBar( 0, oBar, aBtnBar, oDlg ) )

   oFont:End()
   oFont2:End()

RETURN NIL

FUNCTION BtnBar( nBar, oBar, aBtnBar, oDlg )

   DEFINE BUTTONBAR oBar BUTTONSIZE 70, 50 _3DLOOK TOP OF oDlg 2007

   WITH OBJECT oBar

      oBar:bClrGrad := aPubGrad

      oBar:bRClicked := { || NIL }
      oBar:bLClicked := { || NIL }

      oBar:SetFont( oFont )

      oBar:nClrText := CLR_HBLUE

      oBar:Adjust()

   END

   DO CASE

   CASE nBar = 0 // muestra todo.

      DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New 1"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn1 )

      DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify 2" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\floppy.bmp" WHEN( lLigaBtn2 )

      DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplic 3" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\HelpInd.bmp" WHEN( lLigaBtn3 )

      DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del 4"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn4 )

      DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print 5"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn5 )

      DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help 6"   NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\Help.bmp"    WHEN( lLigaBtn6 )

      DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del 7"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn7 )

      DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print 8"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn8 )

      aBtnBar[7]:Show()
      aBtnBar[8]:Show()

      aBtnBar[7]:Refresh()
      aBtnBar[8]:Refresh()

      lLigaBtn1 := .T.
      lLigaBtn2 := .T.
      lLigaBtn3 := .T.
      lLigaBtn4 := .T.
      lLigaBtn5 := .T.
      lLigaBtn6 := .T.
      lLigaBtn7 := .T.
      lLigaBtn8 := .T.

   CASE nBar = 1  // muestra de 1 a 6

      DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New 1"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn1 )

      DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify 2" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\floppy.bmp"  WHEN( lLigaBtn2 )

      DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplic 3" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\HelpInd.bmp" WHEN( lLigaBtn3 )

      DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del 4"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn4 )

      DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print 5"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn5 )

      DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help 6"   NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\Help.bmp"    WHEN( lLigaBtn6 )

      DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del 7"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn7 )

      DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print 8"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn8 )

      aBtnBar[7]:Hide()
      aBtnBar[8]:Hide()

      aBtnBar[7]:Refresh()
      aBtnBar[8]:Refresh()

      lLigaBtn1 := .T.
      lLigaBtn2 := .T.
      lLigaBtn3 := .T.
      lLigaBtn4 := .T.
      lLigaBtn5 := .T.
      lLigaBtn6 := .T.
      lLigaBtn7 := .F.
      lLigaBtn8 := .F.

   CASE nBar = 2  // muestra 7 y 8

      DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New 1"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn1 )

      DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify 2" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\floppy.bmp"  WHEN( lLigaBtn2 )

      DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplic 3" NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\HelpInd.bmp" WHEN( lLigaBtn3 )

      DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del 4"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn4 )

      DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print 5"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn5 )

      DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help 6"   NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\Help.bmp"    WHEN( lLigaBtn6 )

      DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del 7"    NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn7 )

      DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print 8"  NOBORDER GROUP ;
         FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn8 )

      aBtnBar[1]:Hide()
      aBtnBar[2]:Hide()
      aBtnBar[3]:Hide()
      aBtnBar[4]:Hide()
      aBtnBar[5]:Hide()
      aBtnBar[6]:Hide()

      aBtnBar[1]:Refresh()
      aBtnBar[2]:Refresh()
      aBtnBar[3]:Refresh()
      aBtnBar[4]:Refresh()
      aBtnBar[5]:Refresh()
      aBtnBar[6]:Refresh()

      aBtnBar[7]:Show()
      aBtnBar[8]:Show()

      aBtnBar[7]:Refresh()
      aBtnBar[8]:Refresh()

      lLigaBtn1 := .F.
      lLigaBtn2 := .F.
      lLigaBtn3 := .F.
      lLigaBtn4 := .F.
      lLigaBtn5 := .F.
      lLigaBtn6 := .F.
      lLigaBtn7 := .T.
      lLigaBtn8 := .T.

   ENDCASE

RETURN NIL

// FIN / END  - kapiabafwh@gmail.com
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: lose focus on buttonbar

Postby Silvio.Falconi » Thu Apr 27, 2023 4:49 pm

I understand that you don't understand,
when I show the two buttons I have to put them in first and second place not at the bottom of the buttobar

I want to do it this way for a logical question, if I select a record (or more records) I can delete it or print it, so I don't need the new, edit, duplicate buttons.

Image


entiendo que tu no entiendas,
cuando muestro los dos botones tengo que ponerlos en primer y segundo lugar no en la parte inferior de la barra de botones

Quiero hacerlo de esta manera por una pregunta lógica, si selecciono un registro (o más registros) puedo eliminarlo o imprimirlo, por lo que no necesito los botones nuevo, editar, duplicar.

Please compile it before and you can see what I mean

Code: Select all  Expand view  RUN
#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"



function Main()

       RddSetDefault( "DBFCDX" )

       SetHandleCount( 100 )
       FWNumFormat( "E", .t. )

       SET DATE FORMAT "dd-mm-yyyy"
       SET DELETED     ON
       SET CENTURY     ON
       SET EPOCH TO    year( date() ) - 20
       SET MULTIPLE    OFF
       SetGetColorFocus(RGB(255,255,224))
       SetMGetColorFocus(rgb(255,255,224))


       test()

      RETURN NIL


Function test()
   local oDlg,oDbf,oFont
   local oBar,aBtnBar:=array(8)

   local  nBottom   := 27.2
   local  nRight    := 89
   local  nWd       := Max( nRight * DLG_CHARPIX_W, 180 )
   local  nHt       := nBottom * DLG_CHARPIX_H



       oDbf :=TDatabase():Open( , "Customer", "DBFCDX", .T. )
       oDbf:setorder(1)
       oDbf:Gotop()


 DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
         TiTle "test"


   @ 90,10 Button "Select one" size 100,18 PIXEL OF oDlg action (oBrw:SelectRow( 2 ),Btnbar(2,oBar,aBtnBar,oDlg))
   @ 90,200 Button "DeSelect one" size 100,18 PIXEL OF oDlg action (oBrw:SelectRow( 0 ),Btnbar(1,oBar,aBtnBar,oDlg))

 @ 110,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
          DATASOURCE oDbf AUTOCOLS  ;
          AUTOSORT FONT oFont;
          NOBORDER CELL LINES


         WITH OBJECT oBrw
            :SetMultiSelectCol()
            :CreateFromCode()
          END

          ACTIVATE DIALOG oDlg  CENTER   ;
          ON INIT Btnbar(1,oBar,aBtnBar,oDlg)
RETURN NIL
//--------------------------------------------------------//
Function Btnbar(nBar,oBar,aBtnBar,oDlg)
 local aGrad:= { | lPressed | If( ! lPressed,;
                 { { 1,  RGB( 250,250,245),  RGB( 250,250,245)} },;
                 { { 1, RGB( 245,245,235), RGB( 245,245,235)} } ) }



 DEFINE BUTTONBAR oBar OF oDlg  SIZE 80,70  TOP NOBORDER  2015



  Do case
  case nbar =1



   DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New"     action nil
   DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify"  action nil
   DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate" action nil
   DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del"      action nil
   DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print" action oBrw:report()
   DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help"     action nil  BTNRIGHT
  * DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del"     action nil
  * DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print"  action oBrw:report()

   * aBtnBar[7]:hide()
   * aBtnBar[8]:hide()

 case nbar = 2

   aBtnBar[1]:hide()
   aBtnBar[2]:hide()
   aBtnBar[3]:hide()
   aBtnBar[4]:hide()
   aBtnBar[5]:hide()


     DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del"    action nil
     DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print"   action oBrw:report()
      DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help"     action nil  BTNRIGHT
  endcase

  WITH OBJECT oBar
      oBar:bClrGrad := aGrad
      oBar:bRClicked := { || NIL }
      oBar:bLClicked := { || NIL }
      oBar:Adjust()
   END  

    ChangeButtons( oBar )

      AEval( oBar:aControls, { | oCtrl | oCtrl:refresh() } )
 
  return nil


  function ChangeButtons( oBar )
       AEval( oBar:aControls, { | oCtrl | oCtrl:nTop += 4, oCtrl:nHeight -= 4 } )
       return .T.







 


Image

why I cannot press the buttons ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lose focus on buttonbar

Postby karinha » Thu Apr 27, 2023 6:22 pm

Esto?

https://imgur.com/gyajN7M

Image

Regars, saludos
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: lose focus on buttonbar

Postby karinha » Thu Apr 27, 2023 6:24 pm

Después -> Select One

https://imgur.com/hbQiURl

Image

Correct?

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: lose focus on buttonbar

Postby karinha » Thu Apr 27, 2023 7:07 pm

Hola Silvio, a ver si ahora te entendí bien.
Hello Silvio, see if I understood you well now.

Code: Select all  Expand view  RUN

// Idea Original by Silvio Falconi. - Version: 2.0
// C:\FWH..\SAMPLES\SILBTNF2.PRG - Modificado en: 27/04/2023 - Joao.

#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"

#Define aPubGrad {| lInvert | If( lInvert, ;
                 { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                 { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
                 },                                                         ;
                 { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
                 { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
                 } ) }

// controle de Botones.
STATIC oFont, lLigaBtn1 := .T., lLigaBtn2 := .T., lLigaBtn3 := .T., ;
              lLigaBtn4 := .T., lLigaBtn5 := .T., lLigaBtn6 := .T., ;
              lLigaBtn7 := .T., lLigaBtn8 := .T.

STATIC oBar

FUNCTION Main() // Ejemplo original by Silvio Falconi.

   LOCAL oDlg, oDbf, cTitle, aBtnBar := ARRAY(8), cSay, oSay, oFont2, oExit, ;
         oBtn1, oBtn2
   LOCAL nBottom := 27.2
   LOCAL nRight  := 89
   LOCAL nWd     := Max( nRight * DLG_CHARPIX_W, 180 )  // 703.10
   LOCAL nHt     := nBottom * DLG_CHARPIX_H             // 410.72

   SKinButtons()

   cSay   := OemToAnsi( "I LOVE FIVEWIN THE BEST!"              )
   cTitle := OemToAnsi( "Silvio Falconi And The Power of FiveWin " + ;
                        "Cambiar Botones en Tiempo Real." )

   DEFINE FONT oFont  NAME "Segoe UI Light" SIZE 0, -16 BOLD
   DEFINE FONT oFont2 NAME "Segoe UI Light" SIZE 0, -28 BOLD

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL TITLE cTitle ;
      COLORS CLR_BLACK, CLR_WHITE TRANSPARENT FONT oFont

   oDlg:lHelpIcon := .F.

   @ 200, 150 SAY oSay VAR cSay SIZE 400, 100 PIXEL OF oDlg UPDATE CENTER ;
      FONT oFont2 COLOR CLR_CYAN, CLR_BLACK

   // 2 Botones
   @ 90, 50 BUTTON oBtn1 PROMPT "&Select One" SIZE 120, 40 PIXEL OF oDlg  ;
      ACTION Btnbar2( 2, oBar, aBtnBar, oDlg )

   oBtn1:cTooltip := { "Click-Me Para 2 Botones",                          ;
                       "2 Botones en la Barra", 1, CLR_WHITE, CLR_HBLUE }

   // 5 Botones o mas...
   @ 90, 200 BUTTON oBtn2 PROMPT "&DeSelect One" SIZE 140, 40 PIXEL OF oDlg ;
      ACTION Btnbar5( 5, oBar, aBtnBar, oDlg )

   oBtn2:cTooltip := { "Click-Me Para 5 Botones",                          ;
                       "5 Botones en la Barra", 1, CLR_WHITE, CLR_HBLUE }

   @ 90, 450 BUTTON oExit PROMPT "&Exit" SIZE 080, 40 PIXEL OF oDlg ;
      ACTION( oDlg:End() ) CANCEL

   oExit:cTooltip := { "Click no Botão Para Sair",                          ;
                       "Sair do Programa Agora? ", 1, CLR_WHITE, CLR_HBLUE }

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT( BtnBar5( 0, oBar, aBtnBar, oDlg ), xFocus( oExit ) )

   oFont:End()
   oFont2:End()

RETURN NIL
// 2 Botones o mas o menos...
FUNCTION BtnBar2( nBar, oBar, aBtnBar, oDlg )

   DEFINE BUTTONBAR oBar BUTTONSIZE 70, 50 _3DLOOK TOP OF oDlg 2007

   WITH OBJECT oBar

      oBar:Refresh()

      oBar:bClrGrad := aPubGrad

      oBar:bRClicked := { || NIL }
      oBar:bLClicked := { || NIL }

      oBar:SetFont( oFont )

      oBar:nClrText := CLR_HRED

      oBar:Adjust()

   END

   // los ultimos son en primero - Left.
   DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Delete   " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn4 )

   DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print    " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn5 )

   // Silvio:

   // Botones OFF y Hide() in BtnBar5( nBar, oBar, aBtnBar, oDlg )
   lLigaBtn1 := .F.
   lLigaBtn2 := .F.
   lLigaBtn3 := .F.

   aBtnBar[1]:Hide()
   aBtnBar[2]:Hide()
   aBtnBar[3]:Hide()

   aBtnBar[1]:Refresh()
   aBtnBar[2]:Refresh()
   aBtnBar[3]:Refresh()
   // in BtnBar5() fin / end

RETURN NIL
// 5 Botones o mas...
FUNCTION BtnBar5( nBar, oBar, aBtnBar, oDlg )

   DEFINE BUTTONBAR oBar BUTTONSIZE 70, 50 _3DLOOK TOP OF oDlg 2007

   WITH OBJECT oBar

      oBar:Refresh()

      oBar:bClrGrad := aPubGrad

      oBar:bRClicked := { || NIL }
      oBar:bLClicked := { || NIL }

      oBar:SetFont( oFont )

      oBar:nClrText := CLR_HBLUE

      oBar:Adjust()

   END

   DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New      " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn1 )

   DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify   " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\floppy.bmp"  WHEN( lLigaBtn2 )

   DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate" NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\HelpInd.bmp" WHEN( lLigaBtn3 )

   DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Delete   " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn4 )

   DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print    " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn5 )

   // Botones OFF ? Ninguno.
   lLigaBtn1 := .T.
   lLigaBtn2 := .T.
   lLigaBtn3 := .T.

   aBtnBar[1]:Show()
   aBtnBar[2]:Show()
   aBtnBar[3]:Show()

   aBtnBar[1]:Refresh()
   aBtnBar[2]:Refresh()
   aBtnBar[3]:Refresh()

   // botones ON
   lLigaBtn4 := .T.
   lLigaBtn5 := .T.

   aBtnBar[4]:Show()
   aBtnBar[5]:Show()

   aBtnBar[4]:Refresh()
   aBtnBar[5]:Refresh()

RETURN NIL

FUNCTION xFocus( oObj )

   xSetFocus( oObj )
   xSetFocus( oObj )

RETURN( .T. )

FUNCTION xSetFocus( oObj )    

   LOCAL _oWnd := oObj:oWnd, _oTempo := ""

   DEFINE TIMER _oTempo INTERVAL 10 OF _oWnd ;
          ACTION ( oObj:SetFocus(), _oTempo:End() )

   ACTIVATE TIMER _oTempo

RETURN( .T. )

// FIN / END  - kapiabafwh@gmail.com
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: lose focus on buttonbar

Postby Silvio.Falconi » Fri Apr 28, 2023 7:04 am

karinha wrote:Hola Silvio, a ver si ahora te entendí bien.
Hello Silvio, see if I understood you well now.

Code: Select all  Expand view  RUN

// Idea Original by Silvio Falconi. - Version: 2.0
// C:\FWH..\SAMPLES\SILBTNF2.PRG - Modificado en: 27/04/2023 - Joao.

#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"

#Define aPubGrad {| lInvert | If( lInvert, ;
                 { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                 { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
                 },                                                         ;
                 { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
                 { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
                 } ) }

// controle de Botones.
STATIC oFont, lLigaBtn1 := .T., lLigaBtn2 := .T., lLigaBtn3 := .T., ;
              lLigaBtn4 := .T., lLigaBtn5 := .T., lLigaBtn6 := .T., ;
              lLigaBtn7 := .T., lLigaBtn8 := .T.

STATIC oBar

FUNCTION Main() // Ejemplo original by Silvio Falconi.

   LOCAL oDlg, oDbf, cTitle, aBtnBar := ARRAY(8), cSay, oSay, oFont2, oExit, ;
         oBtn1, oBtn2
   LOCAL nBottom := 27.2
   LOCAL nRight  := 89
   LOCAL nWd     := Max( nRight * DLG_CHARPIX_W, 180 )  // 703.10
   LOCAL nHt     := nBottom * DLG_CHARPIX_H             // 410.72

   SKinButtons()

   cSay   := OemToAnsi( "I LOVE FIVEWIN THE BEST!"              )
   cTitle := OemToAnsi( "Silvio Falconi And The Power of FiveWin " + ;
                        "Cambiar Botones en Tiempo Real." )

   DEFINE FONT oFont  NAME "Segoe UI Light" SIZE 0, -16 BOLD
   DEFINE FONT oFont2 NAME "Segoe UI Light" SIZE 0, -28 BOLD

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL TITLE cTitle ;
      COLORS CLR_BLACK, CLR_WHITE TRANSPARENT FONT oFont

   oDlg:lHelpIcon := .F.

   @ 200, 150 SAY oSay VAR cSay SIZE 400, 100 PIXEL OF oDlg UPDATE CENTER ;
      FONT oFont2 COLOR CLR_CYAN, CLR_BLACK

   // 2 Botones
   @ 90, 50 BUTTON oBtn1 PROMPT "&Select One" SIZE 120, 40 PIXEL OF oDlg  ;
      ACTION Btnbar2( 2, oBar, aBtnBar, oDlg )

   oBtn1:cTooltip := { "Click-Me Para 2 Botones",                          ;
                       "2 Botones en la Barra", 1, CLR_WHITE, CLR_HBLUE }

   // 5 Botones o mas...
   @ 90, 200 BUTTON oBtn2 PROMPT "&DeSelect One" SIZE 140, 40 PIXEL OF oDlg ;
      ACTION Btnbar5( 5, oBar, aBtnBar, oDlg )

   oBtn2:cTooltip := { "Click-Me Para 5 Botones",                          ;
                       "5 Botones en la Barra", 1, CLR_WHITE, CLR_HBLUE }

   @ 90, 450 BUTTON oExit PROMPT "&Exit" SIZE 080, 40 PIXEL OF oDlg ;
      ACTION( oDlg:End() ) CANCEL

   oExit:cTooltip := { "Click no Botão Para Sair",                          ;
                       "Sair do Programa Agora? ", 1, CLR_WHITE, CLR_HBLUE }

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT( BtnBar5( 0, oBar, aBtnBar, oDlg ), xFocus( oExit ) )

   oFont:End()
   oFont2:End()

RETURN NIL
// 2 Botones o mas o menos...
FUNCTION BtnBar2( nBar, oBar, aBtnBar, oDlg )

   DEFINE BUTTONBAR oBar BUTTONSIZE 70, 50 _3DLOOK TOP OF oDlg 2007

   WITH OBJECT oBar

      oBar:Refresh()

      oBar:bClrGrad := aPubGrad

      oBar:bRClicked := { || NIL }
      oBar:bLClicked := { || NIL }

      oBar:SetFont( oFont )

      oBar:nClrText := CLR_HRED

      oBar:Adjust()

   END

   // los ultimos son en primero - Left.
   DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Delete   " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn4 )

   DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print    " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn5 )

   // Silvio:

   // Botones OFF y Hide() in BtnBar5( nBar, oBar, aBtnBar, oDlg )
   lLigaBtn1 := .F.
   lLigaBtn2 := .F.
   lLigaBtn3 := .F.

   aBtnBar[1]:Hide()
   aBtnBar[2]:Hide()
   aBtnBar[3]:Hide()

   aBtnBar[1]:Refresh()
   aBtnBar[2]:Refresh()
   aBtnBar[3]:Refresh()
   // in BtnBar5() fin / end

RETURN NIL
// 5 Botones o mas...
FUNCTION BtnBar5( nBar, oBar, aBtnBar, oDlg )

   DEFINE BUTTONBAR oBar BUTTONSIZE 70, 50 _3DLOOK TOP OF oDlg 2007

   WITH OBJECT oBar

      oBar:Refresh()

      oBar:bClrGrad := aPubGrad

      oBar:bRClicked := { || NIL }
      oBar:bLClicked := { || NIL }

      oBar:SetFont( oFont )

      oBar:nClrText := CLR_HBLUE

      oBar:Adjust()

   END

   DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New      " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn1 )

   DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify   " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\floppy.bmp"  WHEN( lLigaBtn2 )

   DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate" NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\HelpInd.bmp" WHEN( lLigaBtn3 )

   DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Delete   " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\open.bmp"    WHEN( lLigaBtn4 )

   DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print    " NOBORDER GROUP ;
      FILENAME "..\bitmaps\16x16\printer.bmp" WHEN( lLigaBtn5 )

   // Botones OFF ? Ninguno.
   lLigaBtn1 := .T.
   lLigaBtn2 := .T.
   lLigaBtn3 := .T.

   aBtnBar[1]:Show()
   aBtnBar[2]:Show()
   aBtnBar[3]:Show()

   aBtnBar[1]:Refresh()
   aBtnBar[2]:Refresh()
   aBtnBar[3]:Refresh()

   // botones ON
   lLigaBtn4 := .T.
   lLigaBtn5 := .T.

   aBtnBar[4]:Show()
   aBtnBar[5]:Show()

   aBtnBar[4]:Refresh()
   aBtnBar[5]:Refresh()

RETURN NIL

FUNCTION xFocus( oObj )

   xSetFocus( oObj )
   xSetFocus( oObj )

RETURN( .T. )

FUNCTION xSetFocus( oObj )    

   LOCAL _oWnd := oObj:oWnd, _oTempo := ""

   DEFINE TIMER _oTempo INTERVAL 10 OF _oWnd ;
          ACTION ( oObj:SetFocus(), _oTempo:End() )

   ACTIVATE TIMER _oTempo

RETURN( .T. )

// FIN / END  - kapiabafwh@gmail.com
 


Regards, saludos.


Image
then I don't think that for each browse I have to do all this source to then have two buttonbars that when you change from one to the other you see the refresh and then when you pass the mouse there are still the old buttons

entonces no creo que para cada navegación tenga que hacer toda esta fuente para luego tener dos barras de botones que cuando cambias de una a otra ves el refresco y luego al pasar el mouse siguen los botones viejos
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lose focus on buttonbar

Postby Antonio Linares » Fri Apr 28, 2023 9:14 am

Solved thank to this great example from Cristobal Navarro:

barchange.prg
Code: Select all  Expand view  RUN
// developed by Cristobal Navarro

#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"

Function test()

   local oDlg,oDbf,oFont
   local oBar

   local  nBottom   := 27.2
   local  nRight    := 89
   local  nWd       := Max( nRight * DLG_CHARPIX_W, 180 )
   local  nHt       := nBottom * DLG_CHARPIX_H

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
         TiTle "test"
      oDlg:lHelpIcon := .F.      

   @ 90,  10 Button "Second bar" size 100,18 PIXEL OF oDlg action Btnbar(2,oDlg:oBar,oDlg)
   @ 90, 200 Button "First bar"  size 100,18 PIXEL OF oDlg action Btnbar(1,oDlg:oBar,oDlg)

   ACTIVATE DIALOG oDlg  CENTER   ;
          ON INIT ( Btnbar(0,oBar,oDlg), Btnbar(1,oDlg:oBar,oDlg) )
RETURN NIL

//----------------------------------------------------------------------------//

Function Btnbar(nBar,oBar,oDlg)  // ,aBtnBar

   local aBtnBar
   local x

   if Valtype( oBar ) = "O"
      For x := Len( oBar:aControls ) to 1 step - 1
         oBar:Del( x )
      Next x
   endif

  Do case
  case nbar = 0
     DEFINE BUTTONBAR oBar OF oDlg  SIZE 80,70  TOP NOBORDER  2015

  case nbar = 1
   aBtnBar := array(6)
   DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New"       action msginfo()
   DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify"    action msginfo()
   DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate" action msginfo()
   DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del"       action msginfo()
   DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print"     action msginfo()
   DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help"      action msginfo("Help")

  case nbar = 2
   aBtnBar := array(2)
   DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "Del"       action msginfo("Del")
   DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Print"     action msginfo("Print")

  endcase

return oBar

//----------------------------------------------------------------------------//


We have included this example in FWH\samples for the next FWH build to be published very soon
regards, saludos

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

Re: lose focus on buttonbar

Postby Silvio.Falconi » Fri Apr 28, 2023 9:29 am

Antonio Linares wrote:Solved thank to this great example from Cristobal Navarro:

barchange.prg
Code: Select all  Expand view  RUN
// developed by Cristobal Navarro

#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"

Function test()

   local oDlg,oDbf,oFont
   local oBar

   local  nBottom   := 27.2
   local  nRight    := 89
   local  nWd       := Max( nRight * DLG_CHARPIX_W, 180 )
   local  nHt       := nBottom * DLG_CHARPIX_H

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
         TiTle "test"
      oDlg:lHelpIcon := .F.      

   @ 90,  10 Button "Second bar" size 100,18 PIXEL OF oDlg action Btnbar(2,oDlg:oBar,oDlg)
   @ 90, 200 Button "First bar"  size 100,18 PIXEL OF oDlg action Btnbar(1,oDlg:oBar,oDlg)

   ACTIVATE DIALOG oDlg  CENTER   ;
          ON INIT ( Btnbar(0,oBar,oDlg), Btnbar(1,oDlg:oBar,oDlg) )
RETURN NIL

//----------------------------------------------------------------------------//

Function Btnbar(nBar,oBar,oDlg)  // ,aBtnBar

   local aBtnBar
   local x

   if Valtype( oBar ) = "O"
      For x := Len( oBar:aControls ) to 1 step - 1
         oBar:Del( x )
      Next x
   endif

  Do case
  case nbar = 0
     DEFINE BUTTONBAR oBar OF oDlg  SIZE 80,70  TOP NOBORDER  2015

  case nbar = 1
   aBtnBar := array(6)
   DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New"       action msginfo()
   DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify"    action msginfo()
   DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate" action msginfo()
   DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del"       action msginfo()
   DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print"     action msginfo()
   DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help"      action msginfo("Help")

  case nbar = 2
   aBtnBar := array(2)
   DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "Del"       action msginfo("Del")
   DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Print"     action msginfo("Print")

  endcase

return oBar

//----------------------------------------------------------------------------//


We have included this example in FWH\samples for the next FWH build to be published very soon

thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: lose focus on buttonbar

Postby karinha » Fri Apr 28, 2023 10:16 am

Buen día. Maestro Antônio, en este ejemplo de Maestro Navarro, pídale que después de cambiar el botón, pase el mouse sobre los botones de la barra. En este ejemplo del maestro navarro, ¿cómo solucionarlo?

Gracias.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7835
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests