two small problems in my program 
Author Message
 two small problems in my program


#Begin
#!/usr/local/bin/wish -f

#-------------------------------------------
#
# This is the open file window program
#
#-------------------------------------------
toplevel .open

#++++++++++++++++++++++++++++++++++++++++++
#
# Create a frame, a label and an entry
#
#++++++++++++++++++++++++++++++++++++++++++
frame .open.sel -bd 5
pack .open.sel -side top -fill x

label .open.sel.l -text File:
entry .open.sel.show -width 30 -relief sunken -state disabled
pack .open.sel.l -side left
pack .open.sel.show -side left -fill x -expand true

#+++++++++++++++++++++++++++++++++++++++++++
#
# Create a frame, a listbox and a scrollbar
#
#+++++++++++++++++++++++++++++++++++++++++++
frame .open.txt
pack .open.txt -side top -fill both -expand true

listbox .open.txt.lb -relief raised -borderwidth 2 -yscrollcommand
".open.txt.scroll set"
scrollbar .open.txt.scroll -command ".open.txt.lb yview"
pack .open.txt.lb -side left -fill both -expand true
pack .open.txt.scroll -side right -fill y

#++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Create a frame, a OK button and a Cancel button
#
#++++++++++++++++++++++++++++++++++++++++++++++++++
frame .open.end
pack .open.end -side top -fill x -expand true

button .open.end.ok -text OK -command {GetSelectedFile .open.sel.show
.btbar.tstomg .btbar.ritoma .btbar.matori}
button .open.end.cancel -text Cancel -command {destroy .open}
pack .open.end.ok .open.end.cancel -side left -expand true

#+++++++++++++++++++++++++++++++++++++++++
#
# Show the files onto the listbox
#
#+++++++++++++++++++++++++++++++++++++++++
foreach i [lsort [glob *.s2p]] {
  .open.txt.lb insert end $i

Quote:
}

bind .open.txt.lb <Button-1> {
  .open.sel.show config -state normal
  .open.sel.show delete 0 end
  .open.sel.show insert 0 [.open.txt.lb get active]
  .open.sel.show config -state disabled

Quote:
}

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Procedure for getting the selected file name
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
proc GetSelectedFile {w1 w2 w3 w4} {
  ...
  ...
  destroy .open
Quote:
}

#End

The first problem:
if I enlarge the window with the mouse, one can see the listbox (and the
scrollbar as well) can not fill the window.
The second problem is:
I have to click twice, not just once as I want (Button-1>), to out a
file name in the entry widget.

Why?



Wed, 27 Feb 2002 03:00:00 GMT  
 two small problems in my program

I presume #Begin is not really the first line

Quote:
>#Begin
>#!/usr/local/bin/wish -f
> ...
>#End
>The first problem:
>if I enlarge the window with the mouse, one can see the listbox (and the
>scrollbar as well) can not fill the window.

you use -expand too much.  Have only the listbox and the frame managing it
-expand.

 >The second problem is:

Quote:
>I have to click twice, not just once as I want (Button-1>), to out a
>file name in the entry widget.

>Why?

Hmm... the listbox may not be activating until lthe ButtonRelease.  Try binding
to ButtonRelease-1 instead.

--
--
<URL:http://www.glinx.com/~hclsmith/>



Wed, 27 Feb 2002 03:00:00 GMT  
 two small problems in my program

Quote:
> >The first problem:
> >if I enlarge the window with the mouse, one can see the listbox (and the
> >scrollbar as well) can not fill the window.

> you use -expand too much.  Have only the listbox and the frame managing it
> -expand.

You are right. Thanks!

Quote:
>  >The second problem is:
> >I have to click twice, not just once as I want (Button-1>), to out a
> >file name in the entry widget.

> >Why?

> Hmm... the listbox may not be activating until lthe ButtonRelease.  Try binding
> to ButtonRelease-1 instead.

I've tried as you said here. But it dosen't run. Have you tried?


Fri, 01 Mar 2002 03:00:00 GMT  
 two small problems in my program

Quote:

>> >The first problem:
>> >if I enlarge the window with the mouse, one can see the listbox (and the
>> >scrollbar as well) can not fill the window.

>> you use -expand too much.  Have only the listbox and the frame managing it
>> -expand.

>You are right. Thanks!

BTW it's also better if the expanding slaves are last in their master's list.

Quote:
>I've tried as you said here. But it dosen't run. Have you tried?

no, i was guessing.  In fact i can't even reproduce your problem... assuming my
trial code below is your problem

listbox .l
entry .e -state disabled
pack .e -fill x
pack .l -fill both -expand 1
.l insert end a  b  c d
bind .l <Button-1> {
        .e config -state normal
        .e delete 0 end
        .e insert 0 [.l get active]
        .e config -state disabled

Quote:
}

--
<URL:http://www.glinx.com/~hclsmith/>


Fri, 01 Mar 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Two small problems

2. read two sets of data from two spread sheet files to two arrays problem

3. Need help on small programming problem.

4. problem with my small program

5. Two small questions.

6. Two small things

7. Two small questions

8. Two small demos on Icetips

9. connecting two small networks who has experience?

10. Two small additions to Oberon language

11. Was: Programming in the large vs programming in the small

12. large programs, small programs, and the single-language dogma

 

 
Powered by phpBB® Forum Software