Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2937 > unrolled thread

Listbox type progress display?

Started by"McHale, Paul" <Paul.McHale@excelitas.com>
First post2011-06-04 10:21 +0000
Last post2011-06-19 11:27 +0000
Articles 4 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Listbox type progress display? "McHale, Paul" <Paul.McHale@excelitas.com> - 2011-06-04 10:21 +0000
    Re: Listbox type progress display? Albert Retey <awnl@gmx-topmail.de> - 2011-06-05 11:03 +0000
    Re: Listbox type progress display? "McHale, Paul" <Paul.McHale@excelitas.com> - 2011-06-18 21:44 +0000
      Re: Listbox type progress display? Albert Retey <awnl@gmx-topmail.de> - 2011-06-19 11:27 +0000

#2937 — Listbox type progress display?

From"McHale, Paul" <Paul.McHale@excelitas.com>
Date2011-06-04 10:21 +0000
SubjectListbox type progress display?
Message-ID<isd0vg$1pt$1@smc.vnet.net>
Hi,

I sometimes use a workbook as a program that should process start to finish.  CTRL-A, Shift-Enter.  What I would like to have is a single place to monitor for status.  In Windows I would use a ListBox().  This is a small, multi-line text window with scroll capability you can add text to at any time.  I.e.

ListBox.Add[myBox, "Starting Execution "]
ListBox.Add[myBox, "Main task finished "]
ListBox.Add[myBox, "All Tasks finished. "]

Anyone know how to accomplish the same functionality with a Notebook interface?  It can write anywhere.  It doesn't have to be a pop-up.

Thanks,
Paul



Paul McHale  |  Electrical Engineer, Energetics Systems  |  Excelitas Technologies Corp.

Phone:   +1 937.865.3004   |   Fax:  +1 937.865.5170   |   Mobile:   +1 937.371.2828
1100 Vanguard Blvd, Miamisburg, Ohio 45342-0312 USA
Paul.McHale@Excelitas.com<mailto:Paul.McHale@perkinelmer.com>
www.excelitas.com<http://www.excelitas.com>

[cid:image001.png@01CB9136.E3D96D90]

Please consider the environment before printing this e-mail.
This email message and any attachments are confidential and proprietary to Excelitas Technologies Corp. If you are not the intended recipient of this message, please inform the sender by replying to this email or sending a message to the sender and destroy the message and any attachments.
Thank you

[toc] | [next] | [standalone]


#2947

FromAlbert Retey <awnl@gmx-topmail.de>
Date2011-06-05 11:03 +0000
Message-ID<isfnpa$brj$1@smc.vnet.net>
In reply to#2937
Hi,
>
> I sometimes use a workbook as a program that should process start to
> finish.  CTRL-A, Shift-Enter.  What I would like to have is a single
> place to monitor for status.  In Windows I would use a ListBox().
> This is a small, multi-line text window with scroll capability you
> can add text to at any time.  I.e.
>
> ListBox.Add[myBox, "Starting Execution "] ListBox.Add[myBox, "Main
> task finished "] ListBox.Add[myBox, "All Tasks finished. "]
>
> Anyone know how to accomplish the same functionality with a Notebook
> interface?  It can write anywhere.  It doesn't have to be a pop-up.

This is not very sophisticated, but does the job and is relatively simple:

nb = CreateDocument[{}];

notebookAdd[x_] := (
   NotebookWrite[nb, x];
   SelectionMove[nb, After, Cell];
   )

Do[
  Pause[0.1];
  notebookAdd[i],
  {i, 1, 50}
  ]

if you don't need the history, you can also write to the status area
with

SetOptions[EvaluationNotebook[],WindowStatusArea->"test"]

hth,

albert

[toc] | [prev] | [next] | [standalone]


#3172

From"McHale, Paul" <Paul.McHale@excelitas.com>
Date2011-06-18 21:44 +0000
Message-ID<itj67d$k3q$1@smc.vnet.net>
In reply to#2937
Hi Albert,

I appreciate the idea.  Works great with text.  I am having problems writing a Grid[] object to the other notebook.  The functions I am using are based on your example:

(* One time setup *)
nbControl=CreateWindow[DocumentNotebook[{CellGroup[{TextCell["CalibrationControl Execution:   " <> DateString[],"Section"]}]}]];
SelectionMove[nbControl,After,Notebook];

(* functions to add lines and sections *)
notebookAddLine[x_]:=(NotebookWrite[nbControl,Cell[x,"Text"],All];
SelectionMove[nbControl,After,Notebook];)
notebookAddSection[x_]:=(NotebookWrite[nbControl,Cell[x,"Section"],All];
SelectionMove[nbControl,After,Notebook];)

If I create a local object:
mList = {{1, 2}, {3, 4}};
mItem = Grid[mList, Frame -> All]

I get the grid box as one would imagine.  I have tried every variation of NotebookWrite[] I can see, but am unable to write non-text to external notebook.

I.e.
NotebookWrite[nbControl, mItem, All]
Console Message: An unknown box name (Grid) was sent as the BoxForm for the expression. Check the format rules for the expression.

I found another command (as I wrote this) that is very interesting and works.
Paste[nbControl, mList]

Even images work
Paste[nbControl,Rasterize[mItem]]

I'm sure you likely know about this.  Just thought I'd offer it in case anyone didn't.

Thanks,
Paul


Paul McHale  |  Electrical Engineer, Energetics Systems  |  Excelitas Technologies Corp.

Phone:   +1 937.865.3004   |   Fax:  +1 937.865.5170   |   Mobile:   +1 937.371.2828
1100 Vanguard Blvd, Miamisburg, Ohio 45342-0312 USA
Paul.McHale@Excelitas.com
www.excelitas.com



Please consider the environment before printing this e-mail.
This email message and any attachments are confidential and proprietary to 
Excelitas Technologies Corp. If you are not the intended recipient of this 
message, please inform the sender by replying to this email or sending a 
message to the sender and destroy the message and any attachments.
Thank you

-----Original Message-----
From: Albert Retey [mailto:awnl@gmx-topmail.de]
Sent: Sunday, June 05, 2011 7:03 AM
Subject: Re: Listbox type progress display?

Hi,
>
> I sometimes use a workbook as a program that should process start to
> finish.  CTRL-A, Shift-Enter.  What I would like to have is a single
> place to monitor for status.  In Windows I would use a ListBox().
> This is a small, multi-line text window with scroll capability you
> can add text to at any time.  I.e.
>
> ListBox.Add[myBox, "Starting Execution "] ListBox.Add[myBox, "Main
> task finished "] ListBox.Add[myBox, "All Tasks finished. "]
>
> Anyone know how to accomplish the same functionality with a Notebook
> interface?  It can write anywhere.  It doesn't have to be a pop-up.

This is not very sophisticated, but does the job and is relatively simple:

nb = CreateDocument[{}];

notebookAdd[x_] := (
   NotebookWrite[nb, x];
   SelectionMove[nb, After, Cell];
   )

Do[
  Pause[0.1];
  notebookAdd[i],
  {i, 1, 50}
  ]

if you don't need the history, you can also write to the status area
with

SetOptions[EvaluationNotebook[],WindowStatusArea->"test"]

hth,

albert

[toc] | [prev] | [next] | [standalone]


#3186

FromAlbert Retey <awnl@gmx-topmail.de>
Date2011-06-19 11:27 +0000
Message-ID<itkmfr$po9$1@smc.vnet.net>
In reply to#3172
Hi,
>
> I appreciate the idea.  Works great with text.  I am having problems
> writing a Grid[] object to the other notebook.  The functions I am
> using are based on your example:
>
> (* One time setup *)
> nbControl=CreateWindow[DocumentNotebook[{CellGroup[{TextCell["CalibrationControl
> Execution:   "<>  DateString[],"Section"]}]}]];
> SelectionMove[nbControl,After,Notebook];
>
> (* functions to add lines and sections *)
> notebookAddLine[x_]:=(NotebookWrite[nbControl,Cell[x,"Text"],All];
> SelectionMove[nbControl,After,Notebook];)
> notebookAddSection[x_]:=(NotebookWrite[nbControl,Cell[x,"Section"],All];
>
>SelectionMove[nbControl,After,Notebook];)
>
> If I create a local object: mList = {{1, 2}, {3, 4}}; mItem =
> Grid[mList, Frame ->  All]
>
> I get the grid box as one would imagine.  I have tried every
> variation of NotebookWrite[] I can see, but am unable to write
> non-text to external notebook.
>
> I.e. NotebookWrite[nbControl, mItem, All] Console Message: An unknown
> box name (Grid) was sent as the BoxForm for the expression. Check the
> format rules for the expression.

NotebookWrite is a relatively low level function, it has been there even 
before version 6, which means before all the dynamic stuff to create 
graphical user interface. Thus it expects either a string or boxes for 
2d content. It is fortunately almost trivial to create these boxes, so 
this should work (and it will work with everything: Graphics, 
Graphics3D, Manipulate ...):

NotebookWrite[nbControl,ToBoxes[mItem], All]

> I found another command (as I wrote this) that is very interesting
> and works. Paste[nbControl, mList]
>
> Even images work Paste[nbControl,Rasterize[mItem]]
>
> I'm sure you likely know about this.  Just thought I'd offer it in
> case anyone didn't.

in fact I've never seen Paste, presumably because I knew ToBoxes and 
never had the need for it. Paste basically seems to be the high level 
version of NotebookWrite. Good to know, it will make some code more 
compact and clean. It would be interesting to know whether it really is 
equivalent to NotebookWrite[#1,ToBoxes[#2]]& ...

cheers,

albert

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web