×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

usercontrol-classes

usercontrol-classes

usercontrol-classes

(OP)
hi all
iam developing a usercontrol, with 9 command buttons for next,previous,first,last,save,edit,del,find,exit......
i have written a general codeing as mentioned below in usercontrol command button.
but my problem is when i use to add it in form and click the button for move next, the code in the class file never fires,only the code which is at form.usercontrol.next.click event fires...., immeditate replies will be helpful

under usercontrol.class file
code for next button
skip 1
do case
case eof()=.t.
go bott
wait wind "eof reached"
endcase
wait wind "clicked" nowait

under form =>usercontrol.next.click event
thisform.text1.value=fieldname (field name of current DB)


cheers
parthi

RE: usercontrol-classes

If you wish to have the inhereted code fired, you should add a DODEFAULT to the code in your subclass.

Remember: any code, space or comment in the subclass will prevent the baseclasscode to fire if you do not add a DODEFAULT().

>under form =>usercontrol.next.click event
>thisform.text1.value=fieldname (field name of current DB)

Why don't you bind the field of the table to the textbox control (controlsource) and issue a refresh.

In that case, you won't have to put any code in your subclassed control.

Your code would be something like:

PROCEDURE usercontrol.next.click
*- code for next button


LOCAL lnSelect, lcAlias

lnSelect    = SELECT()

*- The alias could be stored as a property of your form
lcAlias    = THISFORM.cTable && select the table

SELECT &lcAlias

IF EOF(lcAlias)
    GO BOTTOM
ELSE
    SKIP 1 IN &lcAlias
    IF EOF(lcAlias)
        GO BOTTOM
    ENDIF
ENDIF

SELECT (lnSelect)
THISFORM.REFRESH()
ENDPROC



HTH,

Weedz (Wietze Veld)
My private project:www.crowncap.demon.nl\info\crwnbase
Download the CrownBase source code !!

RE: usercontrol-classes

(OP)
thanks a lot weedz,
but i cant understand the above explanation, can you just able to explaing me in detail as if iam new to VFP class and user controls.. please...
thanks
parthi

RE: usercontrol-classes

(OP)
hi weedz,
PROCEDURE usercontrol.next.click
*- code for next button


LOCAL lnSelect, lcAlias

lnSelect    = SELECT()

*- The alias could be stored as a property of your form
lcAlias    = THISFORM.cTable && select the table

SELECT &lcAlias

IF EOF(lcAlias)
    GO BOTTOM
ELSE
    SKIP 1 IN &lcAlias
    IF EOF(lcAlias)
        GO BOTTOM
    ENDIF
ENDIF

SELECT (lnSelect)
THISFORM.REFRESH()
ENDPROC
HTH,

i cant understand the code , please explain me to where to put the above code ...
cheers
parthi

RE: usercontrol-classes

1. Open your user control class in the class designer.
2. Go to the menu option: Class/Edit property/method
3. Choose: new property
4. enter: cAlias
5. Choose: new method
6. enter: next
7. Choose close and save changes
8. Open the properties sheet of the user control
9. Choose the method: next and doubleclick

And put in the following code:

LOCAL lnSelect, lcAlias

lnSelect    = SELECT()

lcAlias    = THIS.cAlias && select the table

SELECT &lcAlias

IF EOF(lcAlias)
    GO BOTTOM
ELSE
    SKIP 1 IN &lcAlias
    IF EOF(lcAlias)
        GO BOTTOM
    ENDIF
ENDIF

SELECT (lnSelect)
THISFORM.REFRESH()


10. Put in the click event of your next button the following code:


LOCAL llRetVal

llRetVal = DODEFAULT()

IF llRetVal
 THIS.PARENT.Next()
ENDIF

RETURN llRetVal


11. Put the control on your form.
12. Fill in for the property cAlias of your user control the name of the table through which you wish to navigate.

Et voilĂ , it should work.

Same goes for navigation to the previous record, the first and the last record.

HTH,

Weedz (Wietze Veld)
My private project:www.crowncap.demon.nl\info\crwnbase
Download the CrownBase source code !!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close