Author Topic: Change request/proposal: _UpdateTagWindow()  (Read 8216 times)

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Change request/proposal: _UpdateTagWindow()
« on: November 23, 2007, 03:06:42 am »
Hello SlickTeam,
while working on a GUI macro which uses the the Preview TB I've encountered a problem.
The idle update of the Preview TB interferes with the cb_refresh_output_tab() called by the macro.
_UpdateTagWindow already contains a hardwired 'hook' for the '_tbsearch_form'.
BTW: As I've seen '_tbfilelist_form' and '_select_tree_form' should also be added.
However, the current implementation can't be extended to cover custom (GUI-)macros using the Preview TB.
See below a change proposal how this COULD be solved. I've applied these patches and I've tested it successfully.
Non-GUI macros using the Preview TB are not considered, but I'm not sure if there is any use case for that.

tagwin.e
Code: [Select]
// HS2-CHG: proposal to avoid unintended idle update of the 'Preview TB' #1
_str def_tagwin_noupdate_forms = '_tbsearch_form _tbfilelist_form _select_tree_form';

tagwin.e - _UpdateTagWindow() [line 682]: (Rev. 1.53.2.2)
Code: [Select]
      if ( focus_wid ) {
         //if (!_get_focus()._isEditorCtl(false)) return;
         //HS2-CHG: proposal to avoid unintended idle update of the 'Preview TB' #2
         //if (focus_wid.p_active_form.p_name == "_tbsearch_form") return;
         if (pos ('(^|:b)'focus_wid.p_active_form.p_name'(:b|$)', def_tagwin_noupdate_forms, 1, 'R')) return;

tagwin.e - maybe_add_tagwin_noupdate_form(): new function
Code: [Select]
// HS2-CHG: proposal to avoid unintended idle update of the 'Preview TB' #3
void maybe_add_tagwin_noupdate_form (_str formname)
{
   formname = strip (formname);
   if (!pos ('(^|:b)'formname'(:b|$)', def_tagwin_noupdate_forms, 1, 'R')) {
      def_tagwin_noupdate_forms = strip(def_tagwin_noupdate_forms) :+ ' ' :+ formname;
   }
}

In a macro module this function could be used to 'register' a new user form properly:
Code: [Select]
defload()
{
   maybe_add_tagwin_noupdate_form (OLS_FORM_NAME);
}

It would be nice if you could take care about that and give some feedback please how this will be solved.

Thanks a lot,
HS2

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Change request/proposal: _UpdateTagWindow()
« Reply #1 on: December 12, 2007, 11:10:33 pm »
@SlickTeam: There is one more interference of idle update with autocomplete being active.
Seems that this change solves this issue:
tagwin.e - _UpdateTagWindow():
Code: [Select]
      // HS2-CHG: AutoCompleteActive should be checked as well
      if (CodeHelpActive() || AutoCompleteActive() || CBrowseFocus() || ClassHasFocus() ||
HS2

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Change request/proposal: _UpdateTagWindow()
« Reply #2 on: December 16, 2007, 05:56:38 pm »
Next one: Bookmarks TB
Code: [Select]
      // HS2-CHG: AutoCompleteActive and Bookmarks TB should be taken into account as well
      if (CodeHelpActive() || AutoCompleteActive() || (_get_focus() == _BookmarksFormWid()) || CBrowseFocus() || ClassHasFocus() ||
          AnnotationsHaveFocus()) return;
Seems that the curr. approach is not the optimal solution since the 'exclusion list' is getting longer and longer...

BTW: The Bookmarks TB is missing an initial/auto-update of the Preview TB e.g. on_got_focus.
Code: [Select]
defeventtab _tbbookmarks_form;
void ctl_bookmarks_tree.on_got_focus()
{
   // HS2-ADD: issue 'Preview TB' initial update
   ctl_bookmarks_tree.call_event(CHANGE_SELECTED, ctl_bookmarks_tree._TreeCurIndex(), ctl_bookmarks_tree, ON_CHANGE, 'W');
}
HS2
« Last Edit: December 17, 2007, 11:12:53 am by hs2 »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2834
  • Hero Points: 431
Re: Change request/proposal: _UpdateTagWindow()
« Reply #3 on: March 26, 2008, 03:52:50 pm »
Yes, that little bit of code is a mess.  I have a completely transparent solution, but it will have to wait for 13.0.1.

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Change request/proposal: _UpdateTagWindow()
« Reply #4 on: March 26, 2008, 04:19:57 pm »
Ok - thanks Dennis. So if I'll release an v13 updated 'open local symbol' I'll include the patch I've added to the v12 package. HS2