Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Function CREATE(CtrlEntID, CtrlClassID, CreateParam)
* the form designer does not support events for popup
* menus (those menu items which have sub-menu items), so
* use EVENTQUALIFIER to route events from the EDIT menu
* to the window's OMNIEVENT
Qualifier = 2: "*": @appid<1>: "*OMNIEVENT*": @window: "."
.Menu.Edit->EventQualifier = Qualifier
return 0
 
 
This is the OMNIEVENT for the window: 
Code Block
Function OMNIEVENT(CtrlEntID, CtrlClassID, Message, …)
* if the event is generated from the "Edit" menu item,
* enable and disable the appropriate sub-menu items
declare function EditFind
$insert EditFind_Equates
$insert Logical
 
begin case
  case CtrlEntID [-1,"B."] = "EDIT"
    * get the current focus
    Focus = @@window->Focus
    * check if the control type is paste-able
    locate @Focus->Type in "EDITFIELD,EDITTABLE,EDITBOX,COMBOBOX"
           using "," setting Pos then
      CanPaste = TRUE$
    end else
      CanPaste = FALSE$
    end
    * enable/disable menu items as appropriate
    .Menu.Edit.Undo->Enabled = @Focus->CanUndo
    .Menu.Edit.Cut->Enabled = |
       (abs(@Focus->Selection<2>) > 0)
    .Menu.Edit.Copy->Enabled = .Menu.Edit.Cut->Enabled
    .Menu.Edit.Paste->Enabled = |
       (CanPaste and len(ClipBoard-Text))
    .Menu.Edit.Find->Enabled = |
       EditFind(EFCMD_ISFINDABLE$,Focus)
    .Menu.Edit.Next->Enabled  = |
       EditFind(EFCMD_ISFINDNEXTABLE$,Focus)
    .Menu.Edit.Prev->Enabled  = .Menu.Edit.Next->Enabled
end case
return 0

 

...