Page 1 of 1

Small buttonbar at x,y

PostPosted: Wed Dec 06, 2023 8:40 pm
by Silvio.Falconi
How is it possible that I can't view the buttons in a ButtonBar?

I wish Use the sample samples\barchange.prg, developed by Cristobal Navarro
but the buttonbar must be insert down a xbrowse
so I use Newat() method


barchange.prg with Newat() Method of oBar

Code: Select all  Expand view


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

   aData    := {}
   for n := 1 to 10
      AAdd( aData, { n, "Item-" + StrZero( n, 2 ), ;
         HB_RandomInt( 1, 999 ), HB_RandomInt( 1, 9999 ), ;
         Space( 5 ), ;
         HB_RandomInt( 1, 9999 ) } )
   next


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


   @ 30,10 XBROWSE oBrw SIZE -10,-220 PIXEL OF oDlg ;
      DATASOURCE aData ;
      AUTOCOLS HEADERS { "SlNo", "Item" } ;
      COLSIZES 40 ;
      CELL LINES FOOTERS NOBORDER FASTEDIT

       oBrw:CreateFromCode()



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

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

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

Function Btnbar(nBar,oBar,oDlg,oBrw)  // ,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

    oBar:= TBar():NewAt(  oBrw:nbottom+1, oBrw:nLeft, oBrw:nWidth-120, 25, 80, 25, oDlg, .f.,;
              , , .t., .f., .f., .t., .f., ;
              , , , , , .t. )
     oBar:bClrGrad := { | lPressed | If( ! lPressed,;
                 { { 1, RGB( 250,250,245), RGB( 250,250,245)} },;
                 { { 1, RGB( 245,245,235), RGB( 245,245,235)} } ) }



  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

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



 


Error
Code: Select all  Expand view

   Time from start: 0 hours 0 mins 0 secs
   Error occurred at: 12/06/23, 21:48:52
   Error description: Error BASE/1004  No exported method: ISKINDOF
   Args:
     [   1] = U  
     [   2] = C   TBAR

Stack Calls
===========
   Called from:  => ISKINDOF( 0 )
   Called from: C:\Work\fwh\source\classes\btnbmp.prg => TBTNBMP:NEWBAR( 491 )
   Called from: barchange.prg => BTNBAR( 76 )
   Called from: barchange.prg => (b)TEST( 45 )

Re: Small buttonbar at x,y

PostPosted: Wed Dec 06, 2023 9:08 pm
by Silvio.Falconi
Perhaps I resolve with

oBar:Move( oBrw:nbottom+1, oBrw:nLeft )

when I change from one menu to another there is a flashing throughout the dialog and the xbrowse watch this video

Image

Re: Small buttonbar at x,y

PostPosted: Thu Dec 07, 2023 4:48 am
by cnavarro
Silvio, OK, it's one possible solution, but in this case, please add
Code: Select all  Expand view

   oBar:oWnd:oTop := nil
 

and try

Re: Small buttonbar at x,y

PostPosted: Thu Dec 07, 2023 8:31 am
by Silvio.Falconi
cnavarro wrote:Silvio, OK, it's one possible solution, but in this case, please add
Code: Select all  Expand view

   oBar:oWnd:oTop := nil
 

and try


Make the same flash all

Re: Small buttonbar at x,y

PostPosted: Thu Dec 07, 2023 10:10 am
by Otto
Silvio,
Maybe this will help
topic:
viewtopic.php?f=3&t=17885&p=207288&hilit=flicker&sid=b97da231a3f07dfa7b59bf1f92c0e7b6#p207288

I will post the entire source again.

Regards,
Otto

Re: Small buttonbar at x,y

PostPosted: Thu Dec 07, 2023 11:42 am
by Silvio.Falconi
Otto wrote:Silvio,
Maybe this will help
topic:
viewtopic.php?f=3&t=17885&p=207288&hilit=flicker&sid=b97da231a3f07dfa7b59bf1f92c0e7b6#p207288

I will post the entire source again.

Regards,
Otto

do U have try the test ?

Re: Small buttonbar at x,y

PostPosted: Thu Dec 07, 2023 3:11 pm
by Otto
Silvio, which test?
Regards,
Otto

Re: Small buttonbar at x,y

PostPosted: Thu Dec 07, 2023 6:29 pm
by nageswaragunupudi
This sample is not flickering for me
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oBrw, oBar1, oBar2, aRow, aData := Array( 8, 6 )

   for each aRow in aData
      AEval( aRow, { |u,i| aRow[ i ] := HB_RandomInt( 100,500 ) } )
   next

   DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL

   @  20, 20 XBROWSE oBrw SIZE 480,200 PIXEL OF oDlg ;
      DATASOURCE aData AUTOCOLS CELL LINES NOBORDER
   oBrw:CreateFromCode()

   oDlg:bInit := <||

      @ 220,20 BUTTONBAR oBar1 OF oDlg SIZE 480,32 BUTTONSIZE 100,32
      oBar1:l2007 := .t.
      DEFINE BUTTON OF oBar1 PROMPT "ONE" CENTER
      DEFINE BUTTON OF oBar1 PROMPT "TWO" CENTER
      DEFINE BUTTON OF oBar1 PROMPT "THREE" CENTER
      oBar1:Hide()

      @ 220,20 BUTTONBAR oBar2 OF oDlg SIZE 480,32 BUTTONSIZE 100,32
      oBar2:l2007 := .t.
      DEFINE BUTTON OF oBar2 PROMPT "JAN" CENTER
      DEFINE BUTTON OF oBar2 PROMPT "FEB" CENTER
      DEFINE BUTTON OF oBar2 PROMPT "MARCH" CENTER

      return nil
      >

   @ 280, 20 BUTTON "FIRST BAR" SIZE 150,40 PIXEL OF oDlg ;
      WHEN oBar2:lVisible ACTION ( oBar2:Hide(), oBar1:Show() )
   @ 280,200 BUTTON "SECOND BAR" SIZE 150,40 PIXEL OF oDlg ;
      WHEN oBar1:lVisible ACTION ( oBar1:Hide(), oBar2:Show() )

   ACTIVATE DIALOG oDlg CENTERED

return nil