Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple READ EVENTS question
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00095596
Message ID:
00095794
Views:
25
>Hi David, Here's what you wanted to look at. Thanks!
>
>The form is called from a command button on the main form and it is simply:
>DO FORM search
>
>the search form is set to modeless,in screen and code below for methods.
>
>********************
>ACTIVATE METHOD CODE
>********************
>DO search.mpr
>IF USED('lcSearch')
> IF RECCOUNT('lcSearch') = 0
> STORE 0 TO lnnumrec
> search.cmglnbutton2.command2.enabled = .F.
> search.cmglnbutton2.command3.enabled = .F.
> ELSE
> LnNumrec = RECCOUNT('lcSearch')
> search.cmglnbutton2.command2.enabled = .T.
> search.cmglnbutton2.command3.enabled = .T.
> ENDIF
>ELSE
> STORE 0 TO lnNumrec
> search.cmglnbutton2.command2.enabled = .F.
> search.cmglnbutton2.command3.enabled = .F.
>ENDIF
>search.txtLcstnumb.setfocus
>
>STORE '' TO lcfilter, lcwork, lcstnumb, lcstdir, lcstname, ;
> lcparcel, lcownername, lclegaldes1
>search.refresh()
>
>
>
>*******************
>INIT METHOD CODE
>*******************
>
>PRIVATE lnvalue, lcwork, ;
> lcstnumb, lcstdir, lcstname,lcownername, ;
> lclegaldes1, msg, lctemptable
>
>PUBLIC lnnumrec,lcfilter,lcparcel
>
>STORE '' TO lcfilter, lcwork, lcstnumb, lcstdir, lcstname, ;
> lcparcel, lcownername, lclegaldes1
>
>LcThorough = 0
>
>ON KEY LABEL f3 search.cmglnbutton1.command1.click() && <> command
>ON KEY LABEL f4 search.cmglnbutton1.command2.click() && <> command
>
>
>*********************
>REFRESH METHOD CODE
>*********************
>
> IF USED('lcSearch')
> IF RECCOUNT('LcSearch') = 0
> search.cmglnbutton2.command2.enabled = .F.
> search.cmglnbutton2.command3.enabled = .F.
> ELSE
> search.cmglnbutton2.command2.enabled = .T.
> search.cmglnbutton2.command3.enabled = .T.
> ENDIF
> ENDIF
>THISFORM.grdsrchresults.recordsource = ""
>THISFORM.grdsrchresults.recordsource = "LcSearch"
>THISFORM.grdsrchresults.recordsourceType = 1
>

There are some minor problems with this code, but they shouldn't make much harm. Anyway, try to start your form in more uniformed way, i.e. create custom property in main form, e.g. frmSearch and start search form with command
DO FORM search NAME Mainform.frmSearch LINKED
Doing you will make sure that scope is OK because you linked it to main form property. Also, you better use This or Thisform keywords in your INIT, ACTIVATE events (they are events not methods)
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform