activate an online button

Post Reply
User avatar
Silvio.Falconi
Posts: 7151
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

activate an online button

Post by Silvio.Falconi »

In a dialog I have a buttonbar

Code: Select all | Expand

 DEFINE BUTTONBAR oBar OF oDlg  SIZE 100,70  TOP NOBORDER  2015
then on activate I cal the functions

Code: Select all | Expand

Btnbar(1,oDlg:oBar,oDlg,oDbf,oBrw,aBtnBrow[4]),;
to activate the buttonbar oBar (different menu barchange.prg thanks to Cristobal )

but the button number 6 is hided at init

and then the function Hide_Radio2(oRadio2,.f.,oSay,oLines,oBar) to show or not the button number 6

but when I try to make oBar:aControls[6]:show()

Code: Select all | Expand

 
 Error description: Error BASE/1004  Metodo non disponibile: ACONTROLS
   Args:
     [   1] = U   

Stack Calls
===========
   Called from: source\PConti.prg => ACONTROLS( 0 )
   Called from: source\PConti.prg => HIDE_RADIO2( 681 )
   
   
It tells me it can't find the aControls method.....why ?


please try this small test

Code: Select all | Expand

// 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)

   @ 90, 400 Button "hide/show button"  size 100,18 PIXEL OF oDlg action Hide_button(oDlg:oBar)

   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")
   
              aBtnBar[6]:hide()
              
  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

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


Function Hide_button(oBar)
        oBar:arcontrols[6]:show()
   return nil

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 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
Antonio Linares
Site Admin
Posts: 42575
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 36 times
Been thanked: 84 times
Contact:

Re: activate an online button

Post by Antonio Linares »

Dear Silvio,

ON INIT ( Btnbar(0,@oBar,oDlg), Btnbar(1,oDlg:oBar,oDlg ))
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio.Falconi
Posts: 7151
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: activate an online button

Post by Silvio.Falconi »

Fir now i resolved making another buttonbar case 3
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 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
Post Reply