f



3 problems with "A small editor in 8.5.0" ( http://wiki.tcl.tk/20542)

I'm using Tcl/Tk 8.6.4 under WinXP Pro.
Problem 1. I don't see any where to specify desired font.
    There is a code fragment saying
-----------
proc textfenster {mframe {master {}}} {
     if {$master eq {}} {
         text [set mframe].t  -bg white -xscrollcommand [
----------------------------
which I edited to be
-----------
proc textfenster {mframe {master {}}} {
     if {$master eq {}} {
         text [set mframe].t  -font "Courier 20" -bg white 
-xscrollcommand [
----------------------------
It made no difference.

Problem 2. Although moving the button on the y scroll bar moves 
the displayed text, the button snaps back to the very top of the 
scrollbar area.

Problem 3. The x scrollbar has no effect. I notice that any text 
the would extend past the edge is wrapped to the next line.

TIA





0
Richard
1/18/2016 2:40:09 PM
comp.lang.tcl 23428 articles. 2 followers. Post Follow

9 Replies
1332 Views

Similar Articles

[PageSpeed] 28

I've never used the master/peer text widgets.
Does the master widget even need to be packed?
0
Brad
1/18/2016 1:01:01 AM
On Monday, January 18, 2016 at 6:40:16 AM UTC-8, Richard Owlett wrote:
> I'm using Tcl/Tk 8.6.4 under WinXP Pro.
> Problem 1. I don't see any where to specify desired font.
>     There is a code fragment saying
> -----------
> proc textfenster {mframe {master {}}} {
>      if {$master eq {}} {
>          text [set mframe].t  -bg white -xscrollcommand [
> ----------------------------
> which I edited to be
> -----------
> proc textfenster {mframe {master {}}} {
>      if {$master eq {}} {
>          text [set mframe].t  -font "Courier 20" -bg white 
> -xscrollcommand [
> ----------------------------
> It made no difference.
> 
> Problem 2. Although moving the button on the y scroll bar moves 
> the displayed text, the button snaps back to the very top of the 
> scrollbar area.
> 
> Problem 3. The x scrollbar has no effect. I notice that any text 
> the would extend past the edge is wrapped to the next line.
> 
> TIA

The code was attaching the scrollbars to the wrong frame (and doing it twice).
I made these changes, and the scrollbars seem to work.

Ah...just found the font issue.  It has to do with the master/peer text widget relationship.   The font needs to be set on the peer, not the master.  I've added that to the changes below.

Off topic, I really don't like the line continuation style that is used on the wiki page.

    if {$master eq {}} {
        text [set mframe].t -bg white \
            -wrap word
    } else {
      $master peer create [set mframe].t
      [set mframe].t configure \
            -xscrollcommand [list [set mframe].x set] \
            -yscrollcommand [list [set mframe].y set] \
            -font myfont
      scrollbar [set mframe].x -orient horizontal \
        -command [list [set mframe].t xview] \
        -width 12
      scrollbar [set mframe].y -orient vertical \
        -command [list [set mframe].t yview] \
        -width 12
      grid configure [set mframe].t -column 0 -row 0 -sticky nsew
      grid configure [set mframe].x -column 0 -row 1 -sticky ew
      grid configure [set mframe].y -column 1 -row 0 -sticky ns
    }

proc gui { } {
....
font create myfont
font configure myfont -family Courier -size 12
....
}

0
Brad
1/18/2016 1:01:01 AM
At Mon, 18 Jan 2016 08:40:09 -0600 Richard Owlett <rowlett@cloud85.net> wrote:

> 
> I'm using Tcl/Tk 8.6.4 under WinXP Pro.
> Problem 1. I don't see any where to specify desired font.
>     There is a code fragment saying
> -----------
> proc textfenster {mframe {master {}}} {
>      if {$master eq {}} {
>          text [set mframe].t  -bg white -xscrollcommand [
> ----------------------------
> which I edited to be
> -----------
> proc textfenster {mframe {master {}}} {
>      if {$master eq {}} {
>          text [set mframe].t  -font "Courier 20" -bg white 

Did you try

 text [set mframe].t  -font [font Courier 20] -bg white ...

> -xscrollcommand [
> ----------------------------
> It made no difference.
> 
> Problem 2. Although moving the button on the y scroll bar moves 
> the displayed text, the button snaps back to the very top of the 
> scrollbar area.
> 
> Problem 3. The x scrollbar has no effect. I notice that any text 
> the would extend past the edge is wrapped to the next line.

The text area is created with '-wrap word'.  With the -wrap option set to 
something other then 'none', text gets wraped, effectively disabling the x 
scrolling.  Change the -wrap option to 'none' and then the x scrollbar will 
become effective.

> 
> TIA
> 
> 
> 
> 
> 
>                                                                       

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller@deepsoft.com       -- Webhosting Services
              
0
Robert
1/18/2016 4:43:42 PM
On Monday, January 18, 2016 at 9:04:17 AM UTC-8, Brad Lanam wrote:
> I've never used the master/peer text widgets.
> Does the master widget even need to be packed?

No, it doesn't.  So the code can be simplified.  I haven't attempted to clean up the notebook frames, I think $pw.f1 probably isn't necessary.

proc textfenster {mframe master} {
    $master peer create [set mframe].t
    [set mframe].t configure \
          -xscrollcommand [list [set mframe].x set] \
          -yscrollcommand [list [set mframe].y set] \
          -font myfont \
          -foreground black \
          -wrap none
    scrollbar [set mframe].x -orient horizontal \
      -command [list [set mframe].t xview] \
      -width 12
    scrollbar [set mframe].y -orient vertical \
      -command [list [set mframe].t yview] \
      -width 12
    grid configure [set mframe].t -column 0 -row 0 -sticky nsew
    grid configure [set mframe].x -column 0 -row 1 -sticky ew
    grid configure [set mframe].y -column 1 -row 0 -sticky ns
    grid columnconfigure [set mframe] 0 -weight 1
    grid columnconfigure [set mframe] 1 -weight 0
    grid rowconfigure    [set mframe] 0 -weight 1
    grid rowconfigure    [set mframe] 1 -weight 0
    return [set mframe].t
}

proc newTab {{filename {}}} {
    set pw [ttk::panedwindow .nb.pw[llength [.nb tabs]] -orient vertical]
    frame $pw.f1
    frame $pw.f2
    $pw add $pw.f1
    $pw add $pw.f2

    text $pw.f1.t -bg white -wrap none
    textfenster $pw.f2 $pw.f1.t
    $pw.f1.t configure -undo 1
    ...
0
Brad
1/18/2016 5:20:35 PM
On 1/18/2016 10:43 AM, Robert Heller wrote:
> At Mon, 18 Jan 2016 08:40:09 -0600 Richard Owlett <rowlett@cloud85.net> wrote:
>
>>
>> I'm using Tcl/Tk 8.6.4 under WinXP Pro.
>> Problem 1. I don't see any where to specify desired font.
>>      There is a code fragment saying
>> -----------
>> proc textfenster {mframe {master {}}} {
>>       if {$master eq {}} {
>>           text [set mframe].t  -bg white -xscrollcommand [
>> ----------------------------
>> which I edited to be
>> -----------
>> proc textfenster {mframe {master {}}} {
>>       if {$master eq {}} {
>>           text [set mframe].t  -font "Courier 20" -bg white
>
> Did you try
>
>   text [set mframe].t  -font [font Courier 20] -bg white ...

No I had not. But when I do I get an error message:

/begin quoted error message
bad option "Courier": must be actual, configure, create, delete, 
families, measure, metrics, or names
bad option "Courier": must be actual, configure, create, delete, 
families, measure, metrics, or names
     while executing
"font Courier 20"
     (procedure "textfenster" line 4)
     invoked from within
"textfenster $pw.f1"
     (procedure "newTab" line 8)
     invoked from within
"newTab $filename"
     (procedure "menu_open" line 6)
     invoked from within
"menu_open"
     (menu invoke)
/end quoted error message

>
>> -xscrollcommand [
>> ----------------------------
>> It made no difference.
>>
>> Problem 2. Although moving the button on the y scroll bar moves
>> the displayed text, the button snaps back to the very top of the
>> scrollbar area.
>>
>> Problem 3. The x scrollbar has no effect. I notice that any text
>> the would extend past the edge is wrapped to the next line.
>
> The text area is created with '-wrap word'.  With the -wrap option set to
> something other then 'none', text gets wraped, effectively disabling the x
> scrolling.  Change the -wrap option to 'none' and then the x scrollbar will
> become effective.
>

Whether "word" or "none" there is no difference :<
0
Richard
1/18/2016 6:49:45 PM
On 1/18/2016 11:20 AM, Brad Lanam wrote:
> On Monday, January 18, 2016 at 9:04:17 AM UTC-8, Brad Lanam wrote:
>> I've never used the master/peer text widgets.
>> Does the master widget even need to be packed?
>
> No, it doesn't.  So the code can be simplified.  I haven't attempted to clean up the notebook frames, I think $pw.f1 probably isn't necessary.
>
> proc textfenster {mframe master} {
>      $master peer create [set mframe].t
>      [set mframe].t configure \
>            -xscrollcommand [list [set mframe].x set] \
>            -yscrollcommand [list [set mframe].y set] \
>            -font myfont \
>            -foreground black \
>            -wrap none
>      scrollbar [set mframe].x -orient horizontal \
>        -command [list [set mframe].t xview] \
>        -width 12
>      scrollbar [set mframe].y -orient vertical \
>        -command [list [set mframe].t yview] \
>        -width 12
>      grid configure [set mframe].t -column 0 -row 0 -sticky nsew
>      grid configure [set mframe].x -column 0 -row 1 -sticky ew
>      grid configure [set mframe].y -column 1 -row 0 -sticky ns
>      grid columnconfigure [set mframe] 0 -weight 1
>      grid columnconfigure [set mframe] 1 -weight 0
>      grid rowconfigure    [set mframe] 0 -weight 1
>      grid rowconfigure    [set mframe] 1 -weight 0
>      return [set mframe].t
> }
>
> proc newTab {{filename {}}} {
>      set pw [ttk::panedwindow .nb.pw[llength [.nb tabs]] -orient vertical]
>      frame $pw.f1
>      frame $pw.f2
>      $pw add $pw.f1
>      $pw add $pw.f2
>
>      text $pw.f1.t -bg white -wrap none
>      textfenster $pw.f2 $pw.f1.t
>      $pw.f1.t configure -undo 1
>      ...
>

I applied your fixes from both both posts. With a tabbed editor 
my hair will only go grey[er] rather than disappear as I begin to 
grok Tcl/Tk.

*THANK YOU!*

0
Richard
1/18/2016 8:01:34 PM
On Monday, January 18, 2016 at 12:01:40 PM UTC-8, Richard Owlett wrote:
> I applied your fixes from both both posts. With a tabbed editor 
> my hair will only go grey[er] rather than disappear as I begin to 
> grok Tcl/Tk.
> 
> *THANK YOU!*

Be aware that I just applied some quick fixes, and I didn't do a thorough 
analysis of the problem(s) and my stated reasons are probably wrong.

Though I do think the doubled-setup in the original code was causing a lot of the problems.
 

0
Brad
1/18/2016 8:32:16 PM
On 1/18/2016 2:32 PM, Brad Lanam wrote:
> On Monday, January 18, 2016 at 12:01:40 PM UTC-8, Richard Owlett wrote:
>> I applied your fixes from both both posts. With a tabbed editor
>> my hair will only go grey[er] rather than disappear as I begin to
>> grok Tcl/Tk.
>>
>> *THANK YOU!*
>
> Be aware that I just applied some quick fixes, and I didn't do a thorough
> analysis of the problem(s) and my stated reasons are probably wrong.
>
> Though I do think the doubled-setup in the original code was causing a
>  lot of the problems.
>

OK maybe I should have said "apparently *RESOLVED*" <grin>
It is now a least minimally functional. I really was looking for 
opening files in tabs.

I intend to improve things by:
   1. labels the are meaningful to ME.
   2. add the functionality of "A tiny version control" 
[http://wiki.tcl.tk/15355]

As textbook sample problems just never did anything for me, the 
above should be an enlightening experience ;)



0
Richard
1/18/2016 9:34:58 PM
On 1/18/2016 2:32 PM, Brad Lanam wrote:
> On Monday, January 18, 2016 at 12:01:40 PM UTC-8, Richard Owlett wrote:
>> I applied your fixes from both both posts. With a tabbed editor
>> my hair will only go grey[er] rather than disappear as I begin to
>> grok Tcl/Tk.
>>
>> *THANK YOU!*
>
> Be aware that I just applied some quick fixes, and I didn't do a thorough
> analysis of the problem(s) and my stated reasons are probably wrong.
>
> Though I do think the doubled-setup in the original code was causing a
>  lot of the problems.
>

You were right ;/
I've discovered about a half-dozen "potential learning 
experiences", hesitate to call them "bugs" as the code met the 
original programmers desires. I have different goals. It is also 
meeting a a need I didn't fully appreciate - developing a 
suitable debugging style,
0
Richard
1/21/2016 9:20:09 PM
Reply:

Similar Artilces:

"Tk editor application template" [http://wiki.tcl.tk/8288]
I'm using Tk/Tcl 8.6.4 under WinXP Pro SP3 My learning style is to tweak something that is almost what I want until it is. I have three identified problems: 1. What is proper syntax to invoke when sourced from another script? [Works as expected when clicking on filename.] The code reads: #-------------------------------------------------- # Execute the main procedure #-------------------------------------------------- myAppMain $argc $argv However no reference to "argc" exists. 2. How do I add a functional "Find" com...

"::tcl::tm::UnknownHandler ::tclPkgUnknown msgcat 1.4" caused by replacing Tcl 8.4.1 with 8.5.7
In the blog http://planet.larrythecow.org/archives/2009-07-26.html "The Twouble with Tcl" Iain Buchanan shows that redefining OPEN proc leads to the errors similar to what I am getting - when I replaced Tcl 8.4.1 with Tcl 8.5.7. In my case I don't know the exact root cause though ... Any ideas how I should proceed with debugging this issue ? Thanks, Alex tclsh c:/Tornado/host/resource/hutils/tcl/makeSymTbl.tcl ppc tmp.o symTbl.c invalid command name "::tcl::tm::UnknownHandler" while executing "::tcl::tm::UnknownHandler ::tclPkgUnknown msg...

problem with "file executable" on windows, tcl 8.5.2
ActiveState TCL 8.5.2, Windows XP SP2 'file executable' always returns 0, even on .exe and .bat when asked for a file on a network share: % info patchlevel 8.5.2 % set file L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/gen.exe L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/gen.exe % file exists $file 1 % file readable $file 1 % file executable $file 0 % file executable {L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/simenu.bat} 0 However, when copying the files to local disk, the files are qualified as executable: % cp L:/ralf/si++aegis/si++....

Intriguing reference to "TclDOM example directory" at http://wiki.tcl.tk/3895
I'm looking for examples of code involving parsing XML and/or HTML documents. In the 4th from last entry, Mr. Ball makes reference to "the TclDOM example directory". Where might I find that directory? TIA On Feb 15, 11:59=A0am, Richard Owlett <rowl...@pcnetinc.com> wrote: > In the 4th from last entry (of < http://wiki.tcl.tk/3895 >), Mr. Ball mak= es reference to "the > TclDOM example directory". > > Where might I find that directory? On http://wiki.tcl.tk/1407 , the same writer says: Version 2.5 of TclDOM adds a couple of new example scr...

Problem with TDBC in Tcl 8.6.0: version conflict for package "TclOO"
Hi, I've got a problem with Tcl 8.6.0. I tried to run my tcls-script, but received the following error: version conflict for package "TclOO": have 0.7, need 1.0.1 while executing "load c:/tcl_x86/lib/teapot/package/win32-ix86/lib/tdbc_mysql1.0.0/tdbcmysql100.dll tdbcmysql" ("package ifneeded tdbc::mysql 1.0.0" script) invoked from within "package require tdbc::mysql " (file "myscript.tcl" line 4) Looks like the problem is in tdbc. I have already tried to install another version of tdbc, but it didn't help. T...

Fve Ver5.5 (Editor for "Mac OS X"/Unix/Windows) Tcl/Tk script
Fve Ver5.5 (Editor for "Mac OS X"/Unix/Windows) Tcl/Tk script (File_Viewer Editor Version -- Fve Ver5.5) http://www.ne.jp/asahi/kazuo/sasagawa/ For Tcl/Tk 8.4,8.5,8.6: *Changes(Version5.5) 1 Modify the Help file. 2 Added "chmod" Button. (Copy Files...) 3 Added "delete the beginning of a line" item. ("Copy Files..." --> "rename files" MenuButton) 4 Change the startup file name (Mac OS X). $root/_fve/.fverc -> $root/_fve/_fverc <Mac OS X> *** 1. In 2015-6-10 latest Tcl/Tk8.5.18,8.6.4, it...

"Multithreaded" tcl/tk problem?
Hello In short: I ran into serious problems when developing multithreded Tcl/ Tk application in C. After spending (literally!) weeks on debugging and tests, I believe that it narrows down to Tcl/Tk bugs in multithread mode. I tried to find something over net on such problems, but to no success :-( I'll be very grateful if someone could confirm that, or perhaps point out what I'm doing wrong...here's detailed description: I have Win32 C++ application (SCADA/HMI program) which may contain several (from zero to literally hundreths) independent Tcl/Tk "modules". Module is m...

A problem about "[ ]" "( )" "="
I want to read several images saved in a director,and give them to I1,I2 ,I3....,using the following codes: filelist=dir(['c:\MATLAB701\work\...\*.jpg']); for i=1 :length(filelist) I=imread(fullfile('c:\MATLAB701\work\...',filelist(i).name)); end; but failed. Then I used I(i)=imread... ,still failed. How could I do? "John" <mailofww@126.com> wrote in message news:ef19e12.-1@webx.raydaftYaTP... >I want to read several images saved in a director,and give them to > I1,I2 ,I3....,using the following codes: > filelist=dir(['c:\MATLAB701\work\.....

Looking for binary "expect" and "TCL/Tk" (if required) for OpenServer6
Does anybody know where to find "expect" (and related requirements) for OpenServer6? I can download the source files from nist.gov, but they do not compile. The MAN pages are already loaded on the system, so I suspect the programs would be on the distribution media somewhere. Any help would be appreciated. Thanks, Rick On 9 Feb, 17:57, Rick_Hoyle <motosl...@hotmail.com> wrote: > Does anybody know where to find "expect" (and related requirements) > for OpenServer6? I can download the source files from nist.gov, but > they do not compile. The MAN pages are al...

What's wrong with "fconfigure stdout -encoding utf-8" on windows in Tcl 8.5.10
With my built 8.5.10 I tried to issue command "fconfigure stdout - encoding utf-8" to tclsh on WinXP, the tcl prompt then was shown as two dots instead of percentage sign, C:\>tclsh85t.exe % fconfigure stdout -encoding utf-8 =E2=80=A5date The current date is: 11/29/2011 Tue Enter the new date: (mm-dd-yy) time The system cannot accept the date entered. Enter the new date: (mm-dd-yy) =E2=80=A5 =E2=80=A5 So wonder what's wrong with fconfigure on stdout? Is that the issue? On Nov 29, 7:46=C2=A0am, "wrena...@gmail.com" <wrena...@gmail.com> wrote: > With my b...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>jsSHA
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns=3D"http://www.w3.org/1999/xhtml" xml:lang=3D"en"> <head> <title>jsSHA (http://jssha.sourceforge.net/) - Test</title> <script type=3D"text/javascript" src=3D"../src/sha.js"></script> <meta http-equiv=3D"Content-Type" content=3D"text/html;charset=3Dutf-8" /= > <style type=3D"text/css"> label { width: 235px; dis...

TCL Google Groups vs Google+ community "Tcl/Tk Users"
Hi All, Today I came across the Google+ community "Tcl/Tk Users". The community seems to be in its infancy with only a few posts, but I am sure there must have been some announcement that I totally missed. My question is, are there any plans to move this forum to Google+, or is the idea to run Google Groups in parallel with the Google+ community? Cheers TM Am 22.03.2013 11:40, schrieb TM: > Hi All, > > Today I came across the Google+ community "Tcl/Tk Users". The community seems to be in its infancy with only a few posts, but I am sure there must ha...

tcl http with HTTP-EQUIV="Refresh"
does anyone know whether any hidden or slightly obscure feature in the http package allows callback or other eventy processing of html pages using the HTTP-EQUIV="Refresh" feature? I've got a pesky little html scraper problem where the target page is an auto-refresher, and am wondering whether any support for this was included in the http client package... off to frolic in the tcl source now... de -- .............................................................................. :De Clarke, Software Engineer UCO/Lick Observatory, UCSC: :Mail: de@ucolick....

TCL 8.5.6 invalid command name "clock"
Hello, I running a c++ application with an Tcl 8.5.5. interpreter. Now I try to update TCL to version 8.5.6. While running the application with TCL 8.5.6 I get the following error: invalid command name "clock" while executing "clock seconds" Is there something I might have overseen, or is this a bug in version 8.5.6. Thank you for help in advance. Kind Regards sindbad0815@googlemail.com wrote: > I running a c++ application with an Tcl 8.5.5. interpreter. Now I try > to > update TCL to version 8.5.6. While running the application with TCL > 8.5.6 I ge...

Web resources about - 3 problems with "A small editor in 8.5.0" ( http://wiki.tcl.tk/20542) - comp.lang.tcl

Problem novel - Wikipedia, the free encyclopedia
Working class, or proletarian novels are often also social problem novels . This was in many ways a reaction to rapid industrialization , and ...

Cheque use declining but fraud still a problem
Cheques account for less than 5 per cent of non-cash transactions in Australia but last year there were nearly 200 cheque fraud offences

No shuttle? No problem. Space City’s new carrier aircraft exhibit soars
Independence sits atop the Shuttle Carrier Aircraft. (credit: Lee Hutchinson) HOUSTON—It was the bitterest of pills for Houston, the home of ...

Existing Home Sales Bounce Essentially a Mirage; Supply Drops to 11-Year Low: Is that a Problem?
Home Sales Mirage Bounce December existing Home Sales bounced a whopping 14.7% from November's dismal showing. But most of that bounce was a ...

Complaining About Social Media? You’re Part Of The Problem.
... for following people back. If anything, this “quid pro quo” thing we’ve created on social networks is part of what has created the very problem ...

Tesla had problems with its Falcon Wing doors — but crazy car doors have a long history
... associated with putting together doors as complex as those found the X. As it turns out, Tesla did indeed encounter for than a few problems ...

The Problem Is Power Itself
... to ensure that only the ‘right’ people control state power, but by reducing state power itself. Put differently, the fundamental problem is ...

Viola Davis: The problem isn’t the Oscars, the problem is the whole industry
... her anger and sadness at the system that devalues her as a woman and as an artist. So, Viola has chimed in about #OscarsSoWhite. “The problem ...

IDG Contributor Network: The machine learning problem of the next decade
A few months ago, my company, CrowdFlower, ran a machine learning competition on Kaggle . It perfectly highlighted the biggest opportunity (and ...

Bill Maher Whitesplains Hollywood’s Diversity Problem: It’s China’s Fault
Hush, hush now Charlotte , Bill Maher has some whitesplaining to do. Hollywood’s diversity problem, said the host on last night’s Real Time With ...

Resources last updated: 1/24/2016 6:13:18 PM