Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why my toolbars are not on same vertical place

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hi,
I do have two toolbars which I do dock on the bottom of the screen.
Therefore i put in the init method of the toolbar:
tbr1 procedure init
this.dock(3,0,500)
this.movable=.f.
endproc

tbr2 procedure init
this.dock(3,400,500)
this.movable=.f.
endproc

the result:
tbr2 has been docked at the bottom of the screen.
tbr1 has been lifted equal to the height of tbr2.

What do I wrong ?
The toolbars are instanciated from my startup.prg.
I do show them from the init-method of a form.

-Bart
 
You are docking to the bottom, so the vertical position
is mute. Also, the width of a toolbar is wider than
would be expected normally. I add a function that returns
the width of all of the contained controls to get an
estimate of the toolbars width. I then use that as an
adjustment factor.

Darrell


Try this:

[tt]
Clear MEMO
Public o1, o2, o3
o1 = CREATEOBJECT("clsTbr")
o2 = CREATEOBJECT("clsTbr")
o3 = CREATEOBJECT("clsTbr")

o1.DOCK(3,0,0)
o2.DOCK(3,o1.LEFT+o1.GetWidth() + 5,0)
o3.DOCK(3,o2.LEFT+o2.GetWidth() + 5,0)
o1.VISIBLE = .T.
o2.VISIBLE = .T.
o3.VISIBLE = .T.


Define CLASS clsTbr AS TOOLBAR

Add OBJECT txtBox AS TEXTBOX WITH VALUE = THIS.NAME
Add OBJECT sep1 AS SEPARATOR
Add OBJECT cboBox AS COMBOBOX WITH ROWSOURCETYPE = 1, ROWSOURCE = "The,List,Of,Values"
Add OBJECT sep2 AS SEPARATOR
Add OBJECT cmdBtn AS COMMANDBUTTON WITH CAPTION = "Click Me"

Procedure INIT
This.txtBox.VALUE = THIS.NAME
This.cmdBtn.HEIGHT = THIS.txtBox.HEIGHT + 3
Endproc

Function GetWidth
Local i, nWidth, oControl
nWidth = 0
For EACH oControl IN THIS.CONTROLS
If oControl.CLASS <> &quot;Separator&quot;
nWidth = nWidth + oControl.WIDTH
Endif
Next
Return nWidth
Endfunc
Enddefine
[/tt]
 
Hi Darrell,
Should copy and paste in a prg work ?
Do I have to declare some particular vars ?
For this piece of code is not doing anything visible to me.
-Bart
 
Darrell,
Sorry,
I made an error in copying this piece of code.
It all works!
Thanks.
-Bart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top