Discussions related to Visual Prolog
Peter Muraya
VIP Member
Posts: 147
Joined: 5 Dec 2012 7:29

Superfluous source argument in window::menuItmListener

Unread post by Peter Muraya »

Hi,
I find the Source argument in the declaration and implementation of the menuItemListener superfluous in my application and would like to hear situations where This keyword would not suffice wherever the Source argument is needed.

The declaration in the window class is:-

Code: Select all

menuItemListener = (window Source, vpiDomains::menuTag MenuTAG).
I think it should be:-

Code: Select all

menuItemListener = (vpiDomains::menuTag MenuTAG).

Code: Select all

implement taskWindow     inherits applicationWindow     open core, vpiDomains   constants     mdiProperty : boolean = true.   clauses     new() :-         applicationWindow::new(),         generatedInitialize().   predicates     onShow : window::showListener. clauses     onShow(_, _CreationData) :-         _MessageForm = messageForm::display(This).  /*Case 1*/   class predicates     onDestroy : window::destroyListener. clauses     onDestroy(_).   class predicates                                                     /*Case 2*/     onHelpAbout : window::menuItemListener. clauses     onHelpAbout(TaskWin, _MenuTag) :-         _AboutDialog = aboutDialog::display(TaskWin).   predicates                                                         /*Case 3*/     onFileExit : window::menuItemListener. clauses     onFileExit(_, _MenuTag) :-         close().   predicates     onSizeChanged : window::sizeListener. clauses     onSizeChanged(_) :-         vpiToolbar::resize(getVPIWindow()).   % This code is maintained automatically, do not update it manually. 16:42:04-24.4.2013 predicates     generatedInitialize : (). clauses     generatedInitialize():-         setText("dirty_code"),         setDecoration(titlebar([closeButton,maximizeButton,minimizeButton])),         setBorder(sizeBorder()),         setState([wsf_ClipSiblings]),         whenCreated({ :- projectToolbar::create(getVpiWindow()) }),         addSizeListener({ :- vpiToolbar::resize(getVpiWindow()) }),         setMdiProperty(mdiProperty),         menuSet(resMenu(resourceIdentifiers::id_TaskMenu)),         addShowListener(onShow),         addSizeListener(onSizeChanged),         addDestroyListener(onDestroy),         addMenuItemListener(resourceIdentifiers::id_help_about, onHelpAbout),         addMenuItemListener(resourceIdentifiers::id_file_exit, onFileExit). % end of automatic code end implement taskWindow
Mutall Data Management Technical Support
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

I agree. The Source arguments are there for historical reasons, but it would be much simpler if they were absent.

(The same goes for all other listeners).

We may decide to change this some day, but the problem is that a lot of existing code will then have to be changed.

But a more plausible path is that we will shift to a menu system based on the command classes which are also used by the ribbon.
Regards Thomas Linder Puls
PDC
Post Reply