|
Home > Archive > dBASE Programming > January 2007 > toolbar twostate button
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
toolbar twostate button
|
|
| Moses Hanna 2007-01-09, 1:30 am |
| Hi,
I have a toolbar, I want to put a button in it for font bold
when a character field selected is fontbold I want the button to be
depressed and if the character field's value is not bold the button to be
released.
I have defined a button in the toolbar class this way
this.FBold = new ToolButton( this )
with ( this.FBold )
Bitmap := "filename BLD.BMP"
speedTip := "Bold Font"
TwoState := true
onClick := class::FBold_onClick
endwith
but the form does not toggle when the form is run
some help how to do that.
Thanks
Moses
| |
| Geoff Wass [dBVIPS] 2007-01-09, 1:30 am |
| In article <sPHDqXLKHHA.796@news-server>, mosesjhanna@optusnet.com.au=20
says...
> Hi,
> I have a toolbar, I want to put a button in it for font bold
> when a character field selected is fontbold I want the button to be=20
> depressed and if the character field's value is not bold the button to be=
=20
> released.
> I have defined a button in the toolbar class this way
> this.FBold =3D new ToolButton( this )
> with ( this.FBold )
> Bitmap :=3D "filename BLD.BMP"
> speedTip :=3D "Bold Font"
> TwoState :=3D true
> onClick :=3D class::FBold_onClick
> endwith
> but the form does not toggle when the form is run
> some help how to do that.
> Thanks
> Moses
>=20
>=20
>=20
>=20
Moses,
Can you give us a few more details about what type of control is holding=20
the charactes that may or may not be bold and how you are testing (or=20
wanting to test) for the presence or absence of bold? Are you wanting=20
the font button to automatically move up and down as you move the cursor=20
through a string of text? I am not sure if this can be done using=20
standard dBL controls. There may be a solution using the WinAPI=20
knowledge of one of the others here.
--=20
Geoff Wass [dBVIPS]
Montr=E9al, Qu=E9bec, Canada
| |
| Moses Hanna 2007-01-09, 1:30 am |
| Hi Geof
my actual target is that I have a reminder to the clients that owe the firm
unpaid fees.
this reminder body is a 15 lines of text.
the reminder will be prepared in a report.
the user wants to play with lines strings and make them underlined or bold
or larger font before the are sent tp the report and printed.
because this can't be done within the report (as fas as I know), so I
designed a form having several entryfields, each entryfields is filled with
a line pf prepared text of the reminder's body.
so the user can manupelate each line (the whole line) by pressing a makebold
button and so.
so when the user navigates the entryfields, the onupdate of the toolbar with
depress or release the bold button depends on how the string in the
entryfields is, same as italic and underline.
this is the best of my knowledge. Is there any other simpler way?.
Thanks for the respond
Moses
"Geoff Wass [dBVIPS]" <gswassREMOVE_ME@attglobal.net> wrote in message
news:MPG.1ffa92d2761ebc2f98969b@news.dbase.com...
In article <sPHDqXLKHHA.796@news-server>, mosesjhanna@optusnet.com.au
says...
> Hi,
> I have a toolbar, I want to put a button in it for font bold
> when a character field selected is fontbold I want the button to be
> depressed and if the character field's value is not bold the button to be
> released.
> I have defined a button in the toolbar class this way
> this.FBold = new ToolButton( this )
> with ( this.FBold )
> Bitmap := "filename BLD.BMP"
> speedTip := "Bold Font"
> TwoState := true
> onClick := class::FBold_onClick
> endwith
> but the form does not toggle when the form is run
> some help how to do that.
> Thanks
> Moses
>
>
>
>
Moses,
Can you give us a few more details about what type of control is holding
the charactes that may or may not be bold and how you are testing (or
wanting to test) for the presence or absence of bold? Are you wanting
the font button to automatically move up and down as you move the cursor
through a string of text? I am not sure if this can be done using
standard dBL controls. There may be a solution using the WinAPI
knowledge of one of the others here.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
| |
| Geoff Wass [dBVIPS] 2007-01-09, 1:30 am |
| In article <waGw#cNKHHA.1068@news-server>, mosesjhanna@optusnet.com.au=20
says...
> Hi Geof
> my actual target is that I have a reminder to the clients that owe the fi=
rm=20
> unpaid fees.
> this reminder body is a 15 lines of text.
> the reminder will be prepared in a report.
> the user wants to play with lines strings and make them underlined or bol=
d=20
> or larger font before the are sent tp the report and printed.
> because this can't be done within the report (as fas as I know), so I=20
> designed a form having several entryfields, each entryfields is filled wi=
th=20
> a line pf prepared text of the reminder's body.
> so the user can manupelate each line (the whole line) by pressing a makeb=
old=20
> button and so.
> so when the user navigates the entryfields, the onupdate of the toolbar w=
ith=20
> depress or release the bold button depends on how the string in the=20
> entryfields is, same as italic and underline.
> this is the best of my knowledge. Is there any other simpler way?.
> Thanks for the respond
> Moses
>=20
> "Geoff Wass [dBVIPS]" <gswassREMOVE_ME@attglobal.net> wrote in message=20
> news:MPG.1ffa92d2761ebc2f98969b@news.dbase.com...
> In article <sPHDqXLKHHA.796@news-server>, mosesjhanna@optusnet.com.au
> says...
be[vbcol=seagreen]
> Moses,
>=20
> Can you give us a few more details about what type of control is holding
> the charactes that may or may not be bold and how you are testing (or
> wanting to test) for the presence or absence of bold? Are you wanting
> the font button to automatically move up and down as you move the cursor
Moses,
Since this is for the whole line (whole entryfield), then it is=20
possible. The ENTRYFIELD.onGotFocus() will have to have the logic for=20
setting the toolbar button to the up or down position and you will need=20
to have a place to store what is chosen for each line (the user could=20
move between entryFields and change his mind about what he wants).
When you use TOOLBAR.attach( oForm ) where oForm is a reference to your=20
form, you will also need to assign a reference to the for for the=20
toolbar so the form can talk to it.
Ex:
f =3D new form()
f.t =3D new toolbar() // the form can refer to the toolbar
f.t.attach( f )=09// the toolbar can refer to the form
if you have f.e =3D new entryfield( f ), then the onGotFocus() for e can=20
refer to form.t to reference the toolbar.
--=20
Geoff Wass [dBVIPS]
Montr=E9al, Qu=E9bec, Canada
| |
| Moses Hanna 2007-01-09, 1:30 am |
| Hi Geof.
1- I tried to put the button in the toolrbar with the twostate = true
On run time the button does not show that it has two state status that is if
the button is clicked, it goes down and when the mouse pointer is out of
it's surface, it comes up again (
2 - what is the code for a button to go down and what is the code for the
button to go up
those two points are my concern, every thing else you said, I have done it
properly. Instead of the entryfield's got focus event, I put the code in the
onupdate function of the tooldbar
Thanks
Moses
Moses,
Since this is for the whole line (whole entryfield), then it is
possible. The ENTRYFIELD.onGotFocus() will have to have the logic for
setting the toolbar button to the up or down position and you will need
to have a place to store what is chosen for each line (the user could
move between entryFields and change his mind about what he wants).
When you use TOOLBAR.attach( oForm ) where oForm is a reference to your
form, you will also need to assign a reference to the for for the
toolbar so the form can talk to it.
Ex:
f = new form()
f.t = new toolbar() // the form can refer to the toolbar
f.t.attach( f ) // the toolbar can refer to the form
if you have f.e = new entryfield( f ), then the onGotFocus() for e can
refer to form.t to reference the toolbar.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
| |
| Geoff Wass [dBVIPS] 2007-01-09, 1:30 am |
| In article <vChHtVbKHHA.1064@news-server>, mosesjhanna@optusnet.com.au=20
says...
> Hi Geof.
> 1- I tried to put the button in the toolrbar with the twostate =3D true
> On run time the button does not show that it has two state status that is=
if=20
> the button is clicked, it goes down and when the mouse pointer is out of=
=20
> it's surface, it comes up again (
> 2 - what is the code for a button to go down and what is the code for the=
=20
> button to go up
> those two points are my concern, every thing else you said, I have done i=
t=20
> properly. Instead of the entryfield's got focus event, I put the code in =
the=20
> onupdate function of the tooldbar
> Thanks
> Moses
>=20
> Moses,
>=20
> Since this is for the whole line (whole entryfield), then it is
> possible. The ENTRYFIELD.onGotFocus() will have to have the logic for
> setting the toolbar button to the up or down position and you will need
> to have a place to store what is chosen for each line (the user could
> move between entryFields and change his mind about what he wants).
>=20
> When you use TOOLBAR.attach( oForm ) where oForm is a reference to your
> form, you will also need to assign a reference to the for for the
> toolbar so the form can talk to it.
>=20
> Ex:
>=20
> f =3D new form()
> f.t =3D new toolbar() // the form can refer to the toolbar
> f.t.attach( f ) // the toolbar can refer to the form
>=20
> if you have f.e =3D new entryfield( f ), then the onGotFocus() for e can
> refer to form.t to reference the toolbar.
>=20
>=20
Moses,
Your toolbar class should be the place where you designate the button as=20
twoState. Here is an example which is based on the online help example:
class myTBar of toolbar
this.imagewidth =3D 16
this.flat =3D true
this.floating =3D false
this.b1 =3D new toolbutton(this)
this.b1.bitmap =3D 'filename ..\artwork\button\dooropen.bmp'=20
this.b1.onClick =3D {;msgbox("door is open")}
this.b1.speedtip =3D 'button1'
this.b1.twoState :=3D true // <--- you need this
this.b1.checked :=3D true // <--- If you want the button to start
// in the 'down' position, you need this.
this.b2 =3D new toolbutton(this)
this.b2.bitmap =3D 'filename ..\artwork\button\doorshut.bmp'=20
this.b2.onClick =3D {;msgbox("door is shut")}
this.b2.speedtip =3D 'button2'
endclass
Changing the TOOLBUTTON.checked value from true to false changes it from=20
the "down" position to the "up" position.
Your ENTRYFIELDs are going to have to have logic in their respective=20
onGotFocus (and maybe onLostFocus) events to set the value of the=20
TOOLBAR.TOOLBUTTON.checked value to true or false.
The logic for the toolbar button's onClick will probably have to rely=20
upon the form.activeControl property to determine in which field the=20
cursor is currently located.
--=20
Geoff Wass [dBVIPS]
Montr=E9al, Qu=E9bec, Canada
| |
| Moses Hanna 2007-01-09, 1:30 am |
| Thanks Geof, You were of great help
Moses
"Geoff Wass [dBVIPS]" <gswassREMOVE_ME@attglobal.net> wrote in message
news:MPG.1ffd2daeac3fbb7c9896a8@news.dbase.com...
In article <vChHtVbKHHA.1064@news-server>, mosesjhanna@optusnet.com.au
says...
> Hi Geof.
> 1- I tried to put the button in the toolrbar with the twostate = true
> On run time the button does not show that it has two state status that is
> if
> the button is clicked, it goes down and when the mouse pointer is out of
> it's surface, it comes up again (
> 2 - what is the code for a button to go down and what is the code for the
> button to go up
> those two points are my concern, every thing else you said, I have done it
> properly. Instead of the entryfield's got focus event, I put the code in
> the
> onupdate function of the tooldbar
> Thanks
> Moses
>
> Moses,
>
> Since this is for the whole line (whole entryfield), then it is
> possible. The ENTRYFIELD.onGotFocus() will have to have the logic for
> setting the toolbar button to the up or down position and you will need
> to have a place to store what is chosen for each line (the user could
> move between entryFields and change his mind about what he wants).
>
> When you use TOOLBAR.attach( oForm ) where oForm is a reference to your
> form, you will also need to assign a reference to the for for the
> toolbar so the form can talk to it.
>
> Ex:
>
> f = new form()
> f.t = new toolbar() // the form can refer to the toolbar
> f.t.attach( f ) // the toolbar can refer to the form
>
> if you have f.e = new entryfield( f ), then the onGotFocus() for e can
> refer to form.t to reference the toolbar.
>
>
Moses,
Your toolbar class should be the place where you designate the button as
twoState. Here is an example which is based on the online help example:
class myTBar of toolbar
this.imagewidth = 16
this.flat = true
this.floating = false
this.b1 = new toolbutton(this)
this.b1.bitmap = 'filename ..\artwork\button\dooropen.bmp'
this.b1.onClick = {;msgbox("door is open")}
this.b1.speedtip = 'button1'
this.b1.twoState := true // <--- you need this
this.b1.checked := true // <--- If you want the button to start
// in the 'down' position, you need this.
this.b2 = new toolbutton(this)
this.b2.bitmap = 'filename ..\artwork\button\doorshut.bmp'
this.b2.onClick = {;msgbox("door is shut")}
this.b2.speedtip = 'button2'
endclass
Changing the TOOLBUTTON.checked value from true to false changes it from
the "down" position to the "up" position.
Your ENTRYFIELDs are going to have to have logic in their respective
onGotFocus (and maybe onLostFocus) events to set the value of the
TOOLBAR.TOOLBUTTON.checked value to true or false.
The logic for the toolbar button's onClick will probably have to rely
upon the form.activeControl property to determine in which field the
cursor is currently located.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
| |
| Geoff Wass [dBVIPS] 2007-01-09, 1:30 am |
| In article <r8BRzWnKHHA.1068@news-server>, mosesjhanna@optusnet.com.au=20
says...
> Thanks Geof, You were of great help
> Moses
Moses,
You're welcome. Have fun with this! And, Happy New Year!
--=20
Geoff Wass [dBVIPS]
Montr=E9al, Qu=E9bec, Canada
|
|
|
|
|