🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Norm MacNeil Tue, 15 Dec 1992 23:38
toplevel message widgets problem
#2
Author: Norm MacNeil
Date: Tue, 15 Dec 1992 23:38
71 lines
2842 bytes
I wanted to be able to put up a "dialog" box with a message (like "Processing -
Please wait...") and then allow the program to continue on until such time as
the internal processing was complete at which time the message box would
disappear.  So I wrote a little procedure...

proc MsgCntl {Op Msg} {
  if {$Op == "END"} {
    catch {destroy .MsgCntl}
  } else {
  # Update any existing windows before continuing...
    update

  # Determine the size and placement of the window
    global .

    set WinHeight 175
    set WinWidth  350

  # Center the box in the existing "." window
    set WinX [expr {([winfo width  .]/2)-($WinWidth/2)+[winfo x .]}]
    set WinY [expr {([winfo height .]/2)-($WinHeight/2)+[winfo y .]}]

  # Create the toplevel window
    toplevel .MsgCntl -class MsgCntl
    wm geometry .MsgCntl ${WinWidth}x${WinHeight}+${WinX}+${WinY}
    wm title .MsgCntl "Message"
    wm iconname .MsgCntl "Msg"

  # Create a dummy frame
    frame .MsgCntl.top -borderwidth 3 -relief raised

  # Create the message widget
    message .MsgCntl.top.msg -justify center
    .MsgCntl.top.msg configure -text [join $Msg]
    pack append .MsgCntl.top .MsgCntl.top.msg {top expand fill}
    pack append .MsgCntl .MsgCntl.top {top expand fill}

  # Now show the message window
    update

  # Now bind all actions to this window
    focus .MsgCntl
    bind .MsgCntl <Visibility> {grab .MsgCntl; focus .MsgCntl}
    grab .MsgCntl
  }

}


So in the program, it would be used like...

MsgCntl BEGIN "Processing - please wait..."
#life happens here
MsgCntl END ""

Anyway, sometimes the text appears in the message window and sometimes it
doesn't.  The above code is littled hacked up from the number of iterations of
trying to get this to work.  One test, I got the message windows to display the
text, exited from the program, and restarted it, and this time the text did NOT
appear so I know it's not from code-fiddling.

What gives on the apparent inconsistency in displaying the text?

Thanks much in advance,
  Norm.
-- 
+-----------------------------------------------------------------------+
 Norm MacNeil                     Phone: (613) 763-7497
 Data Systems                     Fax:   (613) 765-2854
 Bell-Northern Research Ltd.      EMail: norm@bnr.ca (INTERNET)
 #include <disclaimer.std>       "Roller bladers do it in-line!"
Re: toplevel message widgets problem
#3
Author: Jay Schmidgall
Date: Wed, 16 Dec 1992 12:58
14 lines
1189 bytes
In article <1992Dec15.233825.18609@bcars6a8.bnr.ca>, norm@bnr.ca (Norm MacNeil) writes:
|> MsgCntl BEGIN "Processing - please wait..."
|> #life happens here
|> MsgCntl END ""
|> 
|> Anyway, sometimes the text appears in the message window and sometimes it
|> doesn't.

It could be that the events haven't finished processing before you start
your other processing.  Try putting an `update' right after MsgCntl BEGIN

-- 
: jay          jay@vnet.ibm.com    My opinions and ideas, not my employer's.
: shmdgljd@rchland.vnet.ibm.com    (c) Copyright 1992.  All rights reserved.
Re: toplevel message widgets problem
#4
Author: Norm MacNeil
Date: Wed, 16 Dec 1992 14:44
33 lines
2033 bytes
In article <1992Dec16.125806.29710@rchland.ibm.com>, shmdgljd@rchland.vnet.ibm.com (Jay Schmidgall) writes:
|> In article <1992Dec15.233825.18609@bcars6a8.bnr.ca>, norm@bnr.ca (Norm MacNeil) writes:
|> |> MsgCntl BEGIN "Processing - please wait..."
|> |> #life happens here
|> |> MsgCntl END ""
|> |> 
|> |> Anyway, sometimes the text appears in the message window and sometimes it
|> |> doesn't.
|> 
|> It could be that the events haven't finished processing before you start
|> your other processing.  Try putting an `update' right after MsgCntl BEGIN
|> 
|> -- 
|> : jay          jay@vnet.ibm.com    My opinions and ideas, not my employer's.
|> : shmdgljd@rchland.vnet.ibm.com    (c) Copyright 1992.  All rights reserved.

  Well, I thought that the "update" about the 4th last line in the procedure
would have been sufficient, but I tried putting another "update" as you
stated but to no avail:no message appeared.

  I still think it's something simple I've missed 'cause I modelled this proc
after the mkDialog.tcl available in the .../library/demos directory.

  Anyone else got any ideas?

  Thanks,
    Norm.
-- 
+-----------------------------------------------------------------------+
 Norm MacNeil                     Phone: (613) 763-7497
 Data Systems                     Fax:   (613) 765-2854
 Bell-Northern Research Ltd.      EMail: norm@bnr.ca (INTERNET)
 #include <disclaimer.std>       "Roller bladers do it in-line!"
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads