Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!hacgate!ashtate!dbase!tomr From: tomr@dbase.A-T.COM (Tom Rombouts) Newsgroups: comp.databases Subject: Re: dbase IV "popup" while editing data with "read" command Keywords: dbase, data entry Message-ID: <1991Apr5.164724.4798@dbase.A-T.COM> Date: 5 Apr 91 16:47:24 GMT References: <881@imec.UUCP> Reply-To: tomr@dbase.UUCP (Tom Rombouts) Organization: Ashton-Tate Lines: 50 In article <881@imec.UUCP> symons@imec.be (Jan Symons) writes: >I am writing a dbase IV application which uses the "@... get" >and "read" commands for data entry. However I also want the >possibility to fill in the edited field by taking data from a >list of keywords (from another .dbf file) using the "on popup..." >command. > >My problem is that I cannot transfer the choice of the popup >(prompt()) to the variable being edited with the "read" command. >This is roughly how the code looks like : > >define popup P1 from ... prompt field keywords >* keywords is a field in a .dbf file >on selection popup P1 do get_key >@... say "var = " get var >on key label F7 activate P1 >read >on key label F7 >... > >Procedure get_key >deactivate popup >thekey=prompt() >* >* How to transfer "thekey" to "var" now, soo that it looks as if the >* user typed whatever "thekey" contains ???? >* >return This is actually much easier than you realize if you use the VALID command and create a simple User Defined Function (UDF) that returns the proper value. It will be activated automatically if the user enters a value that is not deemed "valid" by the UDF. Also, you can set up an ON KEY handler to allow the user to explicitly activate it. (We often use SHIFT-F1 to activate picklists, to match the dBASE IV Control Center.) Essentially, you can have the UDF() first see if the value is in a .DBF of permissable values. (In many cases, the dBASE IV LOOKUP() function is used for VALID clauses) If not, you can activate a POPUP that uses the PROMPT FIELD option to show a picklist from the .DBF. The user then highlights the one they want and presses Enter. The UDF can then return the PROMPT() value to put that into the GET. This is off the top of my head. Send me e-mail and I can try to dig up some real .PRG code to send you. Tom Rombouts Torrance 'Tater tomr@ashtate.A-T.com