🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.interviews
Article #1038

(none)

#1038
From: Jan Chang
Date: Wed, 01 May 1991 18:38
146 lines
5244 bytes
   Environment: 
     IV2.6 on HP800 running C++ 2.1 
  OR IV2.6 on HP300 running C++ 2.0 

  
   The fix8 under pub/2.6-fixes of interviews.stanford.edu did solve
my StringBrowser's problem.  Thanks.

   Now I have couple problems which my colleagues and I in my division
could not solve.

1). We have a very difficult time to make the StringEditor exact number
    of characters appear on the panel.  In the application,
    the user could select around 20 panels from the main pulldown
    menu.  Each panel will look different, it could be as simple
    as only one FieldEditor (a message, a stringeditor, and another
    message separated by HGlues) and a PushButtonList in it,
    or it could be very complicated with couple two FieldEditors side 
    by side (in another HBox) and a DualStringBrowser underneath them.

    Problem # 1: Say in the panel that I have 20 FieldEditors in 
    a VBox, some of them have 20 characters, some of them only have
    1 character, it appears that the user can input more than the
    length I specified.  Even the FieldEditor has the same length,
    they look like different length.

    Problem #2: If I select one panel, close it, then select it again
    from my pulldown menu, the size of the panel looks different each
    time, the StringEditor and DualStringBrowser stretch and shrink 
    randomly.  I have tried playing with the HGlues, VGlues, 
    Propagate(), but no lock.  

    Does anyone know what is my problem?

Thanks,
Jan

_____________________________________________________________________
      FieldEditor is a HBox containing a label(message), a stringeditor
      and another message. 

      new HBox(
         new HGlue(round(0.3*inch),0),
         _label,                       // Message
         new HGlue(round(0.2*inch),0),
         new Frame(_field, 2),         // StringEditor
         new HGlue(round(0.2*inch),0),
         _units,                       // Message
         new HGlue  // defaults naturalsize = 0 and stretch = hfil
      )
___________________________________________________________________
      This Panel have 2 FieldEditors side by side, and a 
      DualStringBrowser below it.

   hbox->Insert(_fieldEd1);      // FieldEditor
   hbox->Insert(new HGlue);
   hbox->Insert(_fieldEd2);      // FieldEditor

   // String Browser
   _dualStrBr = new DualStrBrowser(
   3,_dualbr_bs, "Source Worklist: ", "Target Worklist: ", 10, 20);

   // PushButtonList
   _pblist = new PushButtonList(pButtons);

   // DualStringBrowser
   hbox1->Insert(new HGlue(round(0.3*inch),0));
   hbox1->Insert(new Frame(_dualStrBr));
   hbox1->Insert(new HGlue);

   //Change(hbox1);

   VBox* vbox = new VBox
   (
      new VGlue(round(0.3*inch),round(0.2*inch),round(1.0*inch)),
      hbox,
      new VGlue(round(0.3*inch),round(0.2*inch),round(1.0*inch)),
      hbox1,
      new VGlue(round(0.8*inch),round(0.2*inch),round(1.0*inch)),
      _pblist
   );
	
   
___________________________________________________________________
      The way I created DualStringBrowser is like this:

void DualStrBrowser::Init (char *left_label, char *right_label) 
{
   input = new Sensor;
   input->Catch(KeyEvent);

   _state->Attach(this);

   _left_sbr = new StringBrowser(_state, numRows, numColumns, false);
   _right_sbr = new StringBrowser(_state, numRows, numColumns, true);

   _left_label = new Message(left_label);
   _right_label = new Message(right_label);

   _mvInfoLst = new TLst;

   Insert(Interior());
}

Interactor* DualStrBrowser::Interior () 
{
   const int space = round(.1*inch);

   Interactor* left_frame = new Frame(AddVScroller(_left_sbr));
   Interactor* right_frame = new Frame(AddVScroller(_right_sbr));

   VBox* buttons = new VBox(
      new PushButton(" Add Before>> ", _state, ADD_BUTTON),
      new VGlue,
      new PushButton(" Append>>     ", _state, APPEND_BUTTON),
      new VGlue,
      new PushButton(" Reset        ", _state, RESET_BUTTON),
      new VGlue,
      new PushButton(" Unselect  ", _state, UNSELECT_BUTTON)
   );
   buttons->Align(Center);

   Tray* t = new Tray;

   t->HBox(t, new HGlue(space),
      _left_label,new HGlue,_right_label,new HGlue(space),t);

   t->HBox(t,left_frame,new HGlue(space,hfil),
        buttons,new HGlue(space,hfil), right_frame,t);

   t->VBox(t, _left_label, left_frame, t);
   t->VBox(t, _right_label, right_frame, t);
   t->VBox(buttons, t);

   t->Align(Left, _right_label, right_frame);
   t->Align(Left, _left_label, left_frame);
   t->Align(Top, left_frame, buttons, right_frame);

    return  new VBox
      (
          new VGlue(space, 0),
          t,
          new VGlue(space, 0)
    );
}
Technical Details
Message-ID: <9105011838.AA05909@hplds3.sid.hp.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!sdd.hp.com!wuarchive!uunet!stanford.edu!HPLDS3.SID.HP.COM!janc

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!sdd.hp.com!wuarchive!uunet!stanford.edu!HPLDS3.SID.HP.COM!janc
From: janc@HPLDS3.SID.HP.COM (Jan Chang)
Newsgroups: comp.windows.interviews
Subject: (none)
Message-ID: <9105011838.AA05909@hplds3.sid.hp.com>
Date: 1 May 91 18:38:12 GMT
Sender: news@shelby.stanford.edu (USENET News System)
Organization: Internet-USENET Gateway at Stanford University
Lines: 146