comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: (Another) IDL 4.0 widget bug & workaround
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: (Another) IDL 4.0 widget bug & workaround [message #4497] Thu, 15 June 1995 00:00
djackson is currently offline  djackson
Messages: 31
Registered: June 1993
Member
I said:

> I hope my running to column 80 doesn't make this unreadable! (if so,
> I'll fix and repost)

Sorry, and here 'tis!

Cheers,
-Dick

-----

;IDL Version: 4.0
;Platform: IRIX 5.3

;Symptom: Adding widgets to a base within an already-realized scrolling
; base
; sometimes causes widgets to disappear.

;Details: If we are adding the new widget into empty space that's
; already there
; (say, an open corner of a base) which causes no change in the
; top-level widget's size, all widgets in the top-level base
; disappear.
; However, if adding the new widget causes an expansion or
; contraction,
; it works fine! Running the code below illustrates this
; clearly.
; Put this into a .pro file, .run it, and watch the resulting
; window
; as you hit Enter to let it proceed.

;Workaround: Anytime a widget is added, add a dummy widget somewhere to
; kick
; the top-level widget to grow, then destroy the dummy
; widget.

t = systime(1)
b = widget_base(title = 'Widget Test Window', x_scroll_size = 300, $
y_scroll_size = 300)
frame_flag = 1
b_inner = widget_base(b, /column, frame = frame_flag)
widget_control,b,/realize
s = ''
text_list = [0L]
label_list = ['']
for i = 1, 2 do begin
bi = widget_base(b_inner, /row, frame=frame_flag)
for j = 1, 2 do begin
bj = widget_base(bi, /column, frame=frame_flag)
for k = 1, 2 do begin
bk = widget_base(bj, /row, frame=frame_flag)
for l = 1, 2 do begin
label = strtrim(long(total([i, j, k, l] * $
[1000, 100, 10, 1])), 2)
wt = widget_text(bk, value = label, xsize = 4)

;; The bug caused by the preceding line:
;; If adding the new widget causes no change in the containing
;; widgets'
;; size, all widgets in the top-level base disappear.
;; However, if adding the new widget causes an expansion or
;; contraction
;; it's OK!

;; In this 4x4 grid of text widgets created, X=ones that show
;; bug, O=OK
;; O O O O
;; O X X X
;; O X X X
;; O X X X

print, 'Created widget ' + label
text_list = [wt, text_list]
label_list = [label, label_list]

read, s ; pause for user to hit Enter

;; Trying to fix by adding/removing extra widget from top base
;; THIS WORKS!!
dummy = widget_base(b_inner)
widget_control, dummy, /destroy
print, 'Fixed (if broken) by adding and destroying base '+ $
'within base b_inner.'
read, s

end
end
end
end

for i = 0, n_elements(text_list)-2 do begin
widget_control, text_list(i), /destroy
print, 'Destroyed widget ' + label_list(i)
read, s
end

print, 'Execution time: '+strtrim(systime(1)-t)+' seconds.'

end

-----

-Dick

Dick Jackson djackson@ibd.nrc.ca Institute for Biodiagnostics
Opinions are mine alone. National Research Council Canada, Winnipeg
"And I told him my dream was to live for all time
In some perfect refrain, like the man who wrote 'Danny Boy'."
- Joe Jackson, from the album _Night_Music_, 1994.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Generating MPEG with WAVE
Next Topic: (Another) IDL 4.0 widget bug & workaround

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:59:40 PDT 2025

Total time taken to generate the page: 0.00466 seconds