ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 802 "Online Map Management" - OnMakeSelectionOnBeforeShowStrMenu

Open DominikWidmann opened this issue 5 years ago • 1 comments

Could you please add an event "OnMakeSelectionOnBeforeShowStrMenu" in procedure MakeSelection in Codeunit 802 "Online Map Management". The intention is to add additional values to selection and different behavior based on them. The code below works for our scenario, but maybe I haven't considered some points for general use.

procedure MakeSelection(TableID: Integer; Position: Text[1000])
var
    [RunOnClient]
    LocationProvider: DotNet LocationProvider;
    MainMenu: Text;
    Selection: Integer;
    // - begin Change ->
    ShowStrMenu: Boolean;
    // + end Change <-
begin
    if LocationProvider.IsAvailable then
        MainMenu := StrSubstNo('%1,%2,%3', ThisAddressTxt, DirectionsFromLocationTxt, OtherDirectionsTxt)
    else
        MainMenu := StrSubstNo('%1,%2', ThisAddressTxt, OtherDirectionsTxt);

    // - begin Change ->
    OnMakeSelectionOnBeforeShowStrMenu(MainMenu, ShowStrMenu, TableID, Position, Selection);
    if ShowStrMenu then
    // + end Change <-
      Selection := StrMenu(MainMenu, 1, ShowMapQst);
      case Selection of
          1:
              ProcessMap(TableID, Position);
          2:
              if LocationProvider.IsAvailable then
                  SelectAddress(TableID, Position, 4)
              else
                  ShowOtherMenu(TableID, Position);
          3:
              ShowOtherMenu(TableID, Position);
          // - begin Change ->
          else
              OnAfterMakeSelection(TableID, Position, Selection);
          // + end Change <-
        end;
    end;

[IntegrationEvent(false, false)]
local procedure OnMakeSelectionOnBeforeShowStrMenu(var MainMenu: Text; var ShowStrMenu: Boolean; TableID: Integer; Position: Text[1000]; var Selection: Integer)
begin
end;

[IntegrationEvent(false, false)]
local procedure OnAfterMakeSelection(TableID: Integer; Position: Text[1000]; Selection: Integer)
begin
end;

DominikWidmann avatar May 19 '21 08:05 DominikWidmann

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

JesperSchulz avatar May 25 '21 07:05 JesperSchulz