Trouble with buttonbars oBar

Trouble with buttonbars oBar

Postby hag » Sun Jul 27, 2008 1:35 am

2 issues:
1. error log does not show line numbers in my prg when an error.
2. Get error message when attempting to display a button on the Buttonbar.


Error:

Called from: => __ERRRT_SBASE(0)
Called from: => TBAR:ERROR(170)
Called from: source\rtl\tobject.prg => (b)HBOBJECT(105)
Called from: => TBAR:MSGNOTFOUND(0)
Called from: => TBAR:L2007(164)
Called from: => TBTNBMP:NEWBAR(0)
Called from: .\CASHVER3.PRG => SETWINDOW2(0)
Called from: .\CASHVER3.PRG => MSCREEN2(0)


My code:
DEFINE FONT AFONT NAME "MS SANS SERIF" SIZE 0,-8
DEFINE WINDOW OWND1 FROM 1, 5 TO 20, 75 ;
TITLE "Up Your Cash Flow XT2-2009" ;
MENU( BUILDMENU()) ;
COLOR CLR_GRAY, CLR_GRAY

DEFINE BUTTONBAR oBar SIZE 33,33 OF oWnd1
DEFINE BUTTONBAR oBar2 SIZE 76.5 ,36.25 3D OF OWND1
DEFINE BUTTONBAR oBar3 SIZE 78.5 ,36.25 3D OF OWND1
DEFINE BUTTONBAR oBar4 SIZE 78.5 ,36.25 3D OF OWND1



DEFINE BUTTON FILE "cara.bmp" of oWnd1:oBar NOBORDER GROUP TOOLTIP " Selected financial analysis:"+CRLF+;
" Business valuation. "+CRLF+ ;
" Sensitivity analysis. "+CRLF+ ;
" Annual ratios. "+CRLF+ ;
" Monthly ratios. "+CRLF+ ;
" Z score. "+CRLF+ ;
" Currency converter. " ;
ACTION (SelBar(oBar2,oBar,oBar3))

Any help please can't get into the program
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Antonio Linares » Sun Jul 27, 2008 5:30 am

Harvey,

> 1. error log does not show line numbers in my prg when an error.

line numbers are properly shown (164) and the error is described:

Called from: => TBAR:MSGNOTFOUND(0)
Called from: => TBAR:L2007(164)
Called from: => TBTNBMP:NEWBAR(0)
Called from: .\CASHVER3.PRG => SETWINDOW2(0)

It seems as you are not using a FWH standard Class TBar, as FWH one provides a DATA l2007, which it is not found in yours, when you are trying to create a button for it (TBTNBMP:NEWBAR(0)).

If you want to see all line numbers, then don't use this Harbour (Clipper) compiler flag: /l (L)

/l suppress line number information

2) Here it seems as you are trying to build four buttonbars:

DEFINE BUTTONBAR oBar SIZE 33,33 OF oWnd1
DEFINE BUTTONBAR oBar2 SIZE 76.5 ,36.25 3D OF OWND1
DEFINE BUTTONBAR oBar3 SIZE 78.5 ,36.25 3D OF OWND1
DEFINE BUTTONBAR oBar4 SIZE 78.5 ,36.25 3D OF OWND1

Is that your intention ?
regards, saludos

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

Postby hag » Sun Jul 27, 2008 6:23 am

Antonio:

Thanks for the info. Took out /L and line numbers appear.

You said:
>It seems as you are not using a FWH standard Class TBar, as FWH one >provides a DATA l2007, which it is not found in yours, when you are >trying to create a button for it (TBTNBMP:NEWBAR(0)).

Not sure what you mean. How do I correct this so my button bars with buttons appear?

>2) Here it seems as you are trying to build four buttonbars:

Yes four button bars called for one at a time. Not all visable at the same time.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Antonio Linares » Sun Jul 27, 2008 6:50 am

Harvey,

Here you have a working example. Please provide small and self contained PRGs when requesting for tech support, thanks
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

  local oWnd, oBar1, oBar2, oBar3, oBar4

  DEFINE WINDOW oWnd FROM 1, 5 TO 20, 75 ;
     TITLE "Up Your Cash Flow XT2-2009" ;
     MENU BUILDMENU() ;
     COLOR CLR_GRAY, CLR_GRAY

  DEFINE BUTTONBAR oBar2 SIZE 33, 33 3D OF oWnd
  DEFINE BUTTONBAR oBar3 SIZE 33, 33 3D OF oWnd
  DEFINE BUTTONBAR oBar4 SIZE 33, 33 3D OF oWnd
  DEFINE BUTTONBAR oBar1 SIZE 33, 33 3D OF oWnd // The last one created remains visible

  oBar2:Hide()
  oBar3:Hide()
  oBar4:Hide()

  DEFINE BUTTON OF oBar1 NOBORDER ;
     PROMPT "2" ;
     TOOLTIP "switch to toolbar 2" ;
     ACTION SelBar( oWnd, oBar2 )

  DEFINE BUTTON OF oBar2 NOBORDER ;
     PROMPT "3" ;
     TOOLTIP "switch to toolbar 3" ;
     ACTION SelBar( oWnd, oBar3 )

  DEFINE BUTTON OF oBar3 NOBORDER ;
     PROMPT "4" ;
     TOOLTIP "switch to toolbar 4" ;
     ACTION SelBar( oWnd, oBar4 )

  DEFINE BUTTON OF oBar4 NOBORDER ;
     PROMPT "1" ;
     TOOLTIP "switch to toolbar 1" ;
     ACTION SelBar( oWnd, oBar1 )

  ACTIVATE WINDOW oWnd

return nil

function SelBar( oWnd, oBar )

   oWnd:oBar:Hide()
   oWnd:oBar = oBar
   oWnd:Resize()
   oBar:Show()     

return nil

function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "A menuitem"
   ENDMENU

return oMenu
regards, saludos

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

Postby hag » Tue Jul 29, 2008 3:18 am

Tool bar still not working
Get this error:
Error description: Error BASE/1004 No exported method: GETBTNTOP

Pregram works well if I build the prg. alone. When I link with other prgs I get the above message

Not a clue as to problem.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby nageswaragunupudi » Tue Jul 29, 2008 2:22 pm

Mr Antonio

Encouraged by your above code I tried to make tabbed buttonbar.

Image

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

static oWnd
static oPanel
static aBars[2], nBar
static oTabs

function main()

   DEFINE WINDOW oWnd //MDI

   MakeBar()

   ACTIVATE WINDOW ownd

return nil

static function MakeBar()

   @ 0,0 TABS oTabs OF oWnd ;
      ITEMS 'One', 'Two' ACTION SetBar( nOption )
   oWnd:oTop   := oTabs

   oPanel   := TPanel():New(,,,,oWnd)
   oWnd:oClient   := oPanel

   DEFINE BUTTONBAR aBars[ 2 ] OF oPanel SIZE 80,40 2007
   DEFINE BUTTON OF aBars[ 2 ] PROMPT 'Second-1' FLAT ACTION MsgInfo( This:cCaption )
   DEFINE BUTTON OF aBars[ 2 ] PROMPT 'Second-2' FLAT ACTION MsgInfo( This:cCaption )

   aBars[ 2 ]:Hide()

   DEFINE BUTTONBAR aBars[ 1 ] OF oPanel SIZE 80,40 2007
   DEFINE BUTTON OF aBars[ 1 ] PROMPT 'First-1' FLAT ACTION MsgInfo( This:cCaption )
   DEFINE BUTTON OF aBars[ 1 ] PROMPT 'First-2' FLAT ACTION MsgInfo( This:cCaption )

   aBars[ 1 ]:Hide()

   SetBar( 1 )

return nil

static function SetBar( nOption )

   if nBar != nOption
      if nBar != nil
         aBars[ nBar ]:Hide()
      endif
      nBar           := nOption
      oPanel:oBar    := aBars[ nBar ]
      oPanel:Resize()
      aBars[ nBar ]:Show()
   endif

return nil


I used oPanel because both oTabs and oBar compete for the same area oTop of oWnd.

This code is working fine for normal windows, but not for MDI windows. If ownd is MDI ( uncomment //MDI ), the buttonbar is not getting focus at all. Actually I need this functionality for MDI windows only.

Can you help how to make this work for MDI windows also?
Regards

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

Postby nageswaragunupudi » Tue Jul 29, 2008 3:23 pm

Also I have noticed that ButtonBars created with the syntax @ <row>,<col> BUTTONBAR .... in MDI window never get focus. How is it possible to make the bars created with TBar()NewAt( ... ) in a MDI window work ?
Regards

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

Postby RAMESHBABU » Tue Aug 26, 2008 10:03 am

Mr.Antonio,

I have so many buttons to be placed on the tool bar, which are not fitting
on a single button bar. Hence I planned to have different buttons bars for
different modules like "STUDENTS", "TEACHERS", "LIBRARY", "ACCOUNTS" etc.
And place their respective buttons on the respective Bars.

To achive this functionality, I tried so many ways. But could not suceeed.

Even I tried to use TExplorerBar and TOutLook2003. But they are
occupying lot of space in my client area of main window. After having
seen Mr.Nageswara Rao's tabbed buttonbar functionality, I felt that this
would be the one what I am looking for.

As Mr.Nageswara Rao has pointed that this functonality is not working for
MDI design, I request you to kindly spare your time to make it working
even in MDI environment.

I am sure that this would be one among the best interfaces of FWH.

Regards,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Antonio Linares » Wed Aug 27, 2008 2:35 pm

Nageswararao, Ramesh,

I am currently reviewing it, thanks for your feedback :-)
regards, saludos

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

Postby Antonio Linares » Wed Aug 27, 2008 7:11 pm

First of all, a panel should be created and set as oTop of the window:

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

function Main()

   local oWnd, oPanel

   DEFINE WINDOW oWnd MDI

   oPanel = TPanel():New( ,,,, oWnd )
   oPanel:nHeight = 80
   oWnd:oTop = oPanel

   ACTIVATE WINDOW oWnd

return nil

Image
regards, saludos

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

Postby Antonio Linares » Wed Aug 27, 2008 7:16 pm

Next, we create the Tabs as child of the Panel, and set it as its oTop:

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

function Main()

   local oWnd, oPanel, oTabs

   DEFINE WINDOW oWnd MDI

   oPanel = TPanel():New( ,,,,oWnd )
   oPanel:nHeight = 80
   oWnd:oTop = oPanel

   @ 0, 0 TABS oTabs OF oPanel ;
      ITEMS 'One', 'Two'
     
   oPanel:oTop = oTabs   

   ACTIVATE WINDOW ownd

return nil

Image
regards, saludos

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

Postby Antonio Linares » Wed Aug 27, 2008 7:47 pm

Finally, we create the ButtonBars as child of oPanel, and set them as its DATA oClient when selected. Some fine tunning may be required to properly set the borders on resize, but basically thats the idea :-)
Code: Select all  Expand view
#include 'fivewin.ch'

function Main()

   local oWnd, oPanel, oTabs, aBars[ 2 ]

   DEFINE WINDOW oWnd MDI

   oPanel = TPanel():New( ,,,,oWnd )
   oPanel:nHeight = 57
   oWnd:oTop = oPanel

   @ 0, 0 TABS oTabs OF oPanel ;
      ITEMS 'One', 'Two' ACTION SetBar( nOption, aBars )
     
   DEFINE BUTTONBAR aBars[ 1 ] OF oPanel SIZE 80,40 2007
   DEFINE BUTTON OF aBars[ 1 ] PROMPT 'First-1' FLAT ACTION MsgInfo( This:cCaption )
   DEFINE BUTTON OF aBars[ 1 ] PROMPT 'First-2' FLAT ACTION MsgInfo( This:cCaption )

   DEFINE BUTTONBAR aBars[ 2 ] OF oPanel SIZE 80,40 2007
   DEFINE BUTTON OF aBars[ 2 ] PROMPT 'Second-1' FLAT ACTION MsgInfo( This:cCaption )
   DEFINE BUTTON OF aBars[ 2 ] PROMPT 'Second-2' FLAT ACTION MsgInfo( This:cCaption )
   
   aBars[ 2 ]:Hide()
   
   oPanel:oTop = oTabs
   oPanel:oBar = nil
   oPanel:oClient = aBars[ 1 ]
   oPanel:ReSize()

   ACTIVATE WINDOW ownd

return nil

static function SetBar( nOption, aBars )

   local nBar := AScan( aBars, { | oBar | IsWindowVisible( oBar:hWnd ) } )
   
   aBars[ nBar ]:Hide()
   aBars[ nOption ]:oWnd:oClient = aBars[ nOption ]
   aBars[ nOption ]:oWnd:ReSize()
   aBars[ nOption ]:Show()
   
return nil   

Image
regards, saludos

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

Postby nageswaragunupudi » Thu Aug 28, 2008 4:01 pm

Mr Antonio

Thank you very much. This is working now.

But there is one problem. When we resize the window, there is a lot of ugly flickering. You will notice it if you resize the window.

Can you please advise how to avoid it? Unless we resolve this issue also we may not be able use it in production version
Regards

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

Postby Antonio Linares » Thu Aug 28, 2008 4:19 pm

Dear Rao,

We can implement double buffer painting in Class TPanel and see how it goes :-)
regards, saludos

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

Postby Antonio Linares » Thu Aug 28, 2008 4:49 pm

Much much better now, though still there is a pixel line to fix :-)

http://rapidshare.com/files/140832432/test.zip.html
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 56 guests