|
| Add Buttons? can i use more than one in one form? HOW? |
 |
Mon, 31 Mar 2008 14:56:05 -050 |
Question?
Is there a way to set up an Add Button for one table in a form (reseting a new
row), and have another Add Button do the same thing but on a different table in
the same form? I need to reset a new role for different table in one form.
Please help?
it's best if i get step by step instrustions.
|
| Post Reply
|
| Re: Add Buttons? can i use more than one in one form? HOW? |
 |
Mon, 31 Mar 2008 16:47:30 -040 |
In article <VuaMBl2kIHA.1688@news-server>,
Martin@nationalbenefitadvisory.com says...
>
> Is there a way to set up an Add Button for one table
> in a form (reseting a new row), and have another Add
> Button do the same thing but on a different table in
> the same form?
Try this.
Jean-Pierre Martel, editor
The dBASE Developers Bulletin
Blue Star dBASE Plus Core Concepts Graduate
========== Beginning of VanderDoes1.wfm ========
if not file('FirstDBF.dbf') // If the tables aren't found...
create table FirstDBF (ScrambledText char(30))
use FirstDBF
generate(200)
use // Close the table
endif
if not file('SecondDBF.dbf') // If the tables aren't found...
create table SecondDBF (ScrambledText char(5))
use SecondDBF
generate(100)
use // Close the table
endif
** END HEADER -- do not remove this line
//
// Generated on 2008/03/31
//
parameter bModal
local f
f = new VanderDoes1Form()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class VanderDoes1Form of FORM
with (this)
metric = 6 // Pixels
height = 391.0
left = 160.0
top = 29.0
width = 478.0
text = ""
endwith
this.SECONDDBF1 = new QUERY()
this.SECONDDBF1.parent = this
with (this.SECONDDBF1)
left = 16.5714
top = 13.8636
sql = 'select * from "SecondDBF.DBF"'
active = true
endwith
this.FIRSTDBF1 = new QUERY()
this.FIRSTDBF1.parent = this
with (this.FIRSTDBF1)
left = 5.2857
top = 13.8636
sql = 'select * from "FirstDBF.DBF"'
active = true
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.firstdbf1.rowset
cellHeight = 22.0
allowAddRows = false
height = 185.0
left = 9.0
top = 6.0
width = 342.0
endwith
this.GRID2 = new GRID(this)
with (this.GRID2)
dataLink = form.seconddbf1.rowset
cellHeight = 22.0
allowAddRows = false
height = 185.0
left = 9.0
top = 193.0
width = 342.0
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_ONCLICK
height = 24.0
left = 355.0
top = 7.0
width = 107.0
text = "Add Row"
fontSize = 8.0
fontBold = true
endwith
this.PUSHBUTTON2 = new PUSHBUTTON(this)
with (this.PUSHBUTTON2)
onClick = class::PUSHBUTTON2_ONCLICK
height = 24.0
left = 355.0
top = 194.0
width = 107.0
text = "Add Row"
fontSize = 8.0
fontBold = true
endwith
this.rowset = this.firstdbf1.rowset
Function PUSHBUTTON1_onClick
Form.FirstDBF1.rowset.beginAppend()
Form.Grid1.setFocus()
return
Function PUSHBUTTON2_onClick
Form.SecondDBF1.rowset.beginAppend()
Form.Grid2.setFocus()
return
endclass
========== End of VanderDoes1.wfm ========
|
| Post Reply
|
| Re: Add Buttons? can i use more than one in one form? HOW? |
 |
Thu, 03 Apr 2008 14:51:56 -050 |
Jean-Pierre Martel Wrote:
> In article <VuaMBl2kIHA.1688@news-server>,
> Martin@nationalbenefitadvisory.com says...
> >
> > Is there a way to set up an Add Button for one table
> > in a form (reseting a new row), and have another Add
> > Button do the same thing but on a different table in
> > the same form?
>
> Try this.
>
> Jean-Pierre Martel, editor
> The dBASE Developers Bulletin
> Blue Star dBASE Plus Core Concepts Graduate
>
> ========== Beginning of VanderDoes1.wfm ========
>
> if not file('FirstDBF.dbf') // If the tables aren't found...
> create table FirstDBF (ScrambledText char(30))
> use FirstDBF
> generate(200)
> use // Close the table
> endif
>
> if not file('SecondDBF.dbf') // If the tables aren't found...
> create table SecondDBF (ScrambledText char(5))
> use SecondDBF
> generate(100)
> use // Close the table
> endif
>
> ** END HEADER -- do not remove this line
> //
> // Generated on 2008/03/31
> //
> parameter bModal
> local f
> f = new VanderDoes1Form()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class VanderDoes1Form of FORM
> with (this)
> metric = 6 // Pixels
> height = 391.0
> left = 160.0
> top = 29.0
> width = 478.0
> text = ""
> endwith
>
> this.SECONDDBF1 = new QUERY()
> this.SECONDDBF1.parent = this
> with (this.SECONDDBF1)
> left = 16.5714
> top = 13.8636
> sql = 'select * from "SecondDBF.DBF"'
> active = true
> endwith
>
> this.FIRSTDBF1 = new QUERY()
> this.FIRSTDBF1.parent = this
> with (this.FIRSTDBF1)
> left = 5.2857
> top = 13.8636
> sql = 'select * from "FirstDBF.DBF"'
> active = true
> endwith
>
> this.GRID1 = new GRID(this)
> with (this.GRID1)
> dataLink = form.firstdbf1.rowset
> cellHeight = 22.0
> allowAddRows = false
> height = 185.0
> left = 9.0
> top = 6.0
> width = 342.0
> endwith
>
> this.GRID2 = new GRID(this)
> with (this.GRID2)
> dataLink = form.seconddbf1.rowset
> cellHeight = 22.0
> allowAddRows = false
> height = 185.0
> left = 9.0
> top = 193.0
> width = 342.0
> endwith
>
> this.PUSHBUTTON1 = new PUSHBUTTON(this)
> with (this.PUSHBUTTON1)
> onClick = class::PUSHBUTTON1_ONCLICK
> height = 24.0
> left = 355.0
> top = 7.0
> width = 107.0
> text = "Add Row"
> fontSize = 8.0
> fontBold = true
> endwith
>
> this.PUSHBUTTON2 = new PUSHBUTTON(this)
> with (this.PUSHBUTTON2)
> onClick = class::PUSHBUTTON2_ONCLICK
> height = 24.0
> left = 355.0
> top = 194.0
> width = 107.0
> text = "Add Row"
> fontSize = 8.0
> fontBold = true
> endwith
>
> this.rowset = this.firstdbf1.rowset
>
> Function PUSHBUTTON1_onClick
> Form.FirstDBF1.rowset.beginAppend()
> Form.Grid1.setFocus()
> return
>
> Function PUSHBUTTON2_onClick
> Form.SecondDBF1.rowset.beginAppend()
> Form.Grid2.setFocus()
> return
>
> endclass
>
> ========== End of VanderDoes1.wfm ========
>
Thanks for the help,
i am very, very new to Dabse and codes/ commands. is there a way you could tell
me how to use more than one add button in a form without giving it to me in
codes/ commands? that would help soo much! thanks
|
| Post Reply
|
| Re: Add Buttons? can i use more than one in one form? HOW? |
 |
Thu, 03 Apr 2008 19:12:27 -080 |
>
> i am very, very new to Dabse and codes/ commands. is there a way you could
tell me how to use more than one add button in a form without giving it to me in
codes/ commands? that would help soo much! thanks
>
>
> Martin
Hi Martin, there are 2 tables associated with the form, and each of them
is represented by a rowset: Form.FirstDBF1.rowset and
Form.SecondDBF1.rowset.
All a pushbutton does when clicked is to run the code that it has been
instructed to run, which is to call the "beginAppend" routine for the
rowset and thus append a provisional new row. The code for each of the
buttons is below:
Function PUSHBUTTON1_onClick
Form.FirstDBF1.rowset.beginAppend()
Form.Grid1.setFocus()
return
Function PUSHBUTTON2_onClick
Form.SecondDBF1.rowset.beginAppend()
Form.Grid2.setFocus()
return
Each of these starts the append process for its respective table, then
sets focus on its respective grid which is where the user will enter
information for the new row.
You can have as many database tables and as many buttons on a form as
you like, but each button must call the beginAppend routine (method) of
its respective table. That's what's happening above.
|
| Post Reply
|
| Re: Add Buttons? can i use more than one in one form? HOW? |
 |
Fri, 4 Apr 2008 12:29:16 -0400 |
In article <c2O1rQclIHA.1880@news-server>,
Martin@nationalbenefitadvisory.com says...
>
> I am very, very new to dBASE and codes/ commands. Is
> there a way you could tell me how to use more than one
> add button in a form without giving it to me in codes
> / commands?
I'll give you more detailed instructions. If you can't find how to do
one of the following steps, just ask.
A) under the IDE (under dBASE), open the Form Designer.
B) From the Navigator, drag'n drop each of your two tables into the
form.
C) From the Component palette, drag'n drop two grids.
D) Click on one grid. From the Property inspector, select the Datalink
property and select the appropriate rowset. Do the same for the second
grid (of course, you'll select the other rowset as the datalink).
E) From the Component palette, drag'n drop two pushbuttons.
F) Click on one pushbutton. From the Property inspector, click on the
onClick() event-handler. The Source code editor will open.
G) Type the following code:
Form.FirstDBF1.rowset.beginAppend()
Form.Grid1.setFocus()
Above, you'll replace "FirstDBF1" with the name of the query whose
rowset is connected to your first grid. Close the Source code editor.
H) For the second pushbutton's onClick() event-handler, type the
following code:
Form.SecondDBF1.rowset.beginAppend()
Form.Grid2.setFocus()
Above, you'll replace "SecondDBF1" with the name of the query whose
rowset is connected to your second grid. Close the Source code editor.
I) Save your form under the name you want.
Voilà.
That being said, have you read Ken Mayer/Michael Nuwer's free on-line
tutorial? If not, please take the time to read it. Once you'll have read
it, you'll see how easy it is to use dBASE.
But if you are very, very new to dBASE, I would start with this...
http://www.charlescrumesoftware.com/dbulletin/bu12_a.htm
...then the tutorial.
Jean-Pierre Martel, editor
The dBASE Developers Bulletin
|
| Post Reply
|
|
|
|
|
|
|
|
|
|