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:
00095803
Views:
24
John,

Did you try the excersize of just getting two simple modeless forms to work? Are these forms in a formset?

>The form is called from a command button on the main form and it is simply:
>DO FORM search

In the Click() method right?

A few critiques *s*

In all the method code where you have search. change it to thisform. Thisform is a "nameless" reference to the form that contains the objects, and depending on several things the form might or might not create a memvar named search.

Get rid of the ON KEYs and use the form KeyPress method with KeyPreview=.t. instead, this encapsulates the form better.

I don't think you want to do search.mpr everytime the form activates, i.e. gets focus. You should maybe just do it once in the form.Init() and undo it in the form.Destroy()

The PUBLICs you are using would be much better off being custom properties of the form, again because it encapsulates the form better.

The duplicated code in the Activate() and Refresh() can probably just be in the Refresh()

>
>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
>
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform