Trouble with buttonbars oBar
Trouble with buttonbars oBar
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
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
Harvey
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
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 ?
> 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 ?
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.
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
Harvey
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Harvey,
Here you have a working example. Please provide small and self contained PRGs when requesting for tech support, thanks
Here you have a working example. Please provide small and self contained PRGs when requesting for tech support, thanks
Code: Select all | Expand
#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
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Mr Antonio
Encouraged by your above code I tried to make tabbed buttonbar.
Source coce:
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?
Encouraged by your above code I tried to make tabbed buttonbar.
![Image](http://img61.imageshack.us/img61/6417/tabbedbaruz9.jpg)
Source coce:
Code: Select all | Expand
#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
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
- RAMESHBABU
- Posts: 626
- Joined: Fri Oct 21, 2005 5:54 am
- Location: Secunderabad (T.S), India
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
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
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
First of all, a panel should be created and set as oTop of the window:
![Image](http://img48.imageshack.us/img48/3527/panelze3.png)
Code: Select all | Expand
#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](http://img48.imageshack.us/img48/3527/panelze3.png)
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Next, we create the Tabs as child of the Panel, and set it as its oTop:
![Image](http://img524.imageshack.us/img524/2766/panel2bb6.png)
Code: Select all | Expand
#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](http://img524.imageshack.us/img524/2766/panel2bb6.png)
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
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
![Image](http://img48.imageshack.us/img48/5971/panel3pd6.png)
![Smile :-)](./images/smilies/icon_smile.gif)
Code: Select all | Expand
#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](http://img48.imageshack.us/img48/5971/panel3pd6.png)
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
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
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
G. N. Rao.
Hyderabad, India
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Much much better now, though still there is a pixel line to fix
http://rapidshare.com/files/140832432/test.zip.html
![Smile :-)](./images/smilies/icon_smile.gif)
http://rapidshare.com/files/140832432/test.zip.html