简体   繁体   中英

Creating a toggle box dynamically on a window

I'm taking a toggle box name from a text file And then creating a toggle box dynamically on window. I'm trying to do by this code but window is running successfully but dynamically toggle-box is not creating. I'm not getting where I'm doing wrong?

/* This is in the internal procedure of a window(cb.w)*/

Define variable h as handle.

/*Taking toogle-box name as input*/

Input from check.txt.

    Import unformatted 
    Name_checkbox
Input close.


Create toogle-box h

Assign 
Row = 2

Column = 1

Label = name_checkbox

Visible = true.
     

Add FRAME = FRAME {&FRAME-NAME}:HANDLE to the ASSIGN block.

A complete sample that does not contain import noise, compiles (since a toogle-box is not a widget, but that looks like the least of your problems if your example is representative of your actual code) and works:

def var hwwindow as handle.
def var hwframe  as handle.
def var hwtoggle as handle.

create window hwwindow assign
   width-pixels  = 200
   height-pixels = 200
   status-area   = false
   message-area  = false
   .

create frame hwframe assign
   parent        = hwwindow
   height        = hwwindow:height
   width         = hwwindow:width
   .
   
create toggle-box hwtoggle assign
   frame         = hwframe
   row           = 1.5
   col           = 3
   label         = "dynamic toggle box"
   visible       = true
   sensitive     = true
   .  

apply "entry" to hwtoggle.
wait-for close of hwwindow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM