开发者

move an existing frame to a new frame and create a new frame using old name

开发者 https://www.devze.com 2023-04-06 22:27 出处:网络
i\'ve used a frame in tcl named frame1 and others also. Now i set a proc to destroy all these frames. what i want to do is to move thes开发者_如何学运维e frames to a new variable and create new frames

i've used a frame in tcl named frame1 and others also. Now i set a proc to destroy all these frames. what i want to do is to move thes开发者_如何学运维e frames to a new variable and create new frames of same names. my code looks like this:

proc DestroyAll {} {
    global parent_widget
    global new_widget
    destroy .sf.frame.main.xName
    for {set i 0} {$i < $Count} {incr i} {
        destroy .sf.frame.main.parameter($i)
    }
    destroy .sf.frame.main.buttons
    destroy .sf.frame.buttons
    destroy .sf.frame.main
    destroy .sf.frame
    destroy .sf
}

Populatenewdata --->> this proc creates and fills the sf frame I dont want to destroy these frames, but i want to create new frame. Is there any way of doing this as the filling procedure of this frames is very lengthy and cant be done using loop.


Tk doesn't let you reparent widgets; their names are fixed from the moment you create them to the moment you destroy them. (You can make them visually appear inside different widgets with appropriate -in options to pack and grid, but that's a strictly visual effect.)

Is it possible to manage the model backing up your widgets better so that you can easily recreate views onto that model? (The answer depends on the widgets in use — recreating a canvas or text widget is not at all trivial, though with the text you can clone it from 8.5 onwards — but it's usually fairly easy.) Rethinking what you're doing more strongly in terms of MVC will help.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号