WD6X: DlgFocus Statement Does Not Change the Focus in MacWord

ID: Q126024

The information in this article applies to:

SUMMARY

The Microsoft WordBasic DlgFocus statement is used within a dialog function to set the focus on the dialog box control. However, the DlgFocus statement does not change the focus in a Word 6.0 for the Macintosh dialog box.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

When a dialog box control has the focus, it is active and responds to keyboard input. For example, if a text box has the focus, any text you type appears in that text box. Buttons with focus appear to have a darker ring around them. The DlgFocus statement does not return a WordBasic error when used in a Macintosh Word macro, but the focus is not set to the control.

In the following sample macro, the DlgFocus statement in Case 1 of the dialog function has no effect. If this macro is run in Word 6.x for Windows, the focus is correctly set to the "MyControl1" control.

   Sub Main
      Begin Dialog UserDialog 320, 144, "Microsoft Word", .MyDlgFunction
         OKButton 10, 6, 88, 21
         CancelButton 10, 30, 88, 21
         PushButton 57, 101, 88, 21, "Mybutton", .MyControl1
      End Dialog
      Dim dlg As UserDialog
      x = Dialog(dlg)
   End Sub

   Function MyDlgFunction(identifier$, action, suppvalue)
      Select Case action
         Case 1
            DlgFocus "MyControl1"
         Case Else
      End Select
   End Function

REFERENCES

"Microsoft Word Developer's Kit," version 6.0, Chapter 5, "Working with Custom Dialog Boxes"

Additional query words: dynamic

Keywords          : kbmacro kbprg kbdtacode kbmacroexample macword word6 
Version           : MACINTOSH:6.0,6.0.1,6.0.1a
Platform          : MACINTOSH
Issue type        : kbinfo

Last Reviewed: April 8, 1999