Author Topic: Non-modal dialog goes away  (Read 5676 times)

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Non-modal dialog goes away
« on: April 01, 2009, 04:55:19 PM »
I have a dialog with a list box and a cancel button.
Display the dialog:
show("-xy form1");
I created a handler for the lbutton_double_click() event, to do something with the item the user selected.
When I dbl-click in the list box, the dialog closes.  What am I doing wrong?

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Non-modal dialog goes away
« Reply #1 on: April 01, 2009, 05:20:47 PM »
Seeing the form definition and the double click handler code would make it easier to guess what might be going wrong.

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Non-modal dialog goes away
« Reply #2 on: April 01, 2009, 05:32:45 PM »
I created the form via Macro->New Form..., then cut and pasted the form definition from vusrobjs.e.

Code: [Select]
defeventtab savedViewNM;
void savedViewNM.on_create()
{
   // Populate _ConfigPath() *.vw
   ctllistNM._flfilename("*.vw", maybe_quote_filename( _ConfigPath() ), true, false);
}
_form savedViewNM {
   p_backcolor=0x80000005;
   p_border_style=BDS_DIALOG_BOX;
   p_caption='Saved Views';
   p_clip_controls=false;
   p_forecolor=0x80000008;
   p_height=3995;
   p_width=3240;
   p_x=5220;
   p_y=7905;
   _command_button btnCancelNM {
      p_cancel=true;
      p_caption='Cancel';
      p_default=false;
      p_height=300;
      p_tab_index=3;
      p_tab_stop=true;
      p_width=1260;
      p_x=1040;
      p_y=3560;
   }
   _list_box ctllistNM {
      p_auto_size=true;
      p_backcolor=0x80000005;
      p_border_style=BDS_FIXED_SINGLE;
      p_forecolor=0x80000008;
      p_height=3140;
      p_multi_select=MS_NONE;
      p_scroll_bars=SB_VERTICAL;
      p_tab_index=4;
      p_tab_stop=true;
      p_width=3000;
      p_x=120;
      p_y=360;
      p_eventtab2=_ul2_fillist;
   }
}


void ctllistNM.lbutton_double_click()
{
   _str fn = ctllistNM._lbmulti_select_result();
   ccbOpenView(name);
}

MartyL

  • Senior Community Member
  • Posts: 166
  • Hero Points: 29
  • Synergex
Re: Non-modal dialog goes away
« Reply #3 on: April 02, 2009, 06:44:11 PM »
Using your sample I wasn't able to reproduce the behavior. Could there be some logic in one of the other functions that closes the form? Or possibly closes a view that may be the form by mistake?

This was the complete sample that I used:
Code: [Select]
#include "slick.sh"

_command void showsvNM() name_info(',')
{
   show("-xy savedViewNM");
}

_str _ConfigPath()
{
   return "C:\\test\\";
}

defeventtab savedViewNM;
void savedViewNM.on_create()
{
   // Populate _ConfigPath() *.vw
   ctllistNM._flfilename("*.vw", maybe_quote_filename( _ConfigPath() ), true, false);
}
_form savedViewNM {
   p_backcolor=0x80000005;
   p_border_style=BDS_DIALOG_BOX;
   p_caption='Saved Views';
   p_clip_controls=false;
   p_forecolor=0x80000008;
   p_height=3995;
   p_width=3240;
   p_x=5220;
   p_y=7905;
   _command_button btnCancelNM {
      p_cancel=true;
      p_caption='Cancel';
      p_default=false;
      p_height=300;
      p_tab_index=3;
      p_tab_stop=true;
      p_width=1260;
      p_x=1040;
      p_y=3560;
   }
   _list_box ctllistNM {
      p_auto_size=true;
      p_backcolor=0x80000005;
      p_border_style=BDS_FIXED_SINGLE;
      p_forecolor=0x80000008;
      p_height=3140;
      p_multi_select=MS_NONE;
      p_scroll_bars=SB_VERTICAL;
      p_tab_index=4;
      p_tab_stop=true;
      p_width=3000;
      p_x=120;
      p_y=360;
      p_eventtab2=_ul2_fillist;
   }
}


void ctllistNM.lbutton_double_click()
{
   _str fn = ctllistNM._lbmulti_select_result();
   ccbOpenView(fn);
}

void ccbOpenView(_str name)
{
   say(name);
}