我遇到了一个问题,我开始开发一个应用程序的ui,在这个项目中的一个框架中,我在其中添加了25个控件,但我需要添加更多,当我尝试添加复选框文本和编辑文本时,只显示编辑文本,而文本和复选框不显示,在我的代码中,我之前放置了复选框和文本。
我能做什么?我试图看到控件移动每个有问题的控件的边距,只有当控件是在框架外创建的时,如果应用这种情况,但不起作用,控件拒绝出现。
这是代码:
//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
lay.SetBackColor( "#00bcff" );
lframe = app.CreateLayout( "linear","left,FillXY");
lframe.SetBackColor( "#5f5f5f" );
lframe.SetVisibility( "Show" );
//Creando ventanitas de app
//Creando ventana crear examen, encuesta
Vlc = app.CreateLayout( "Linear","left,FillXY" );
//Vlc.SetSize( 100,100 );
Vlc.SetVisibility( "Hide" );
Vlc.SetBackColor( "#008200" );
Vlc.SetMargins( 0.025, 0.001, 0.025, 0.025 );
//titulo ventana
var Tx = "<u>Crear</u>"
Titvlc = app.CreateText( Tx,0.6,-1,"Html" );
Titvlc.SetTextColor( "#000000" );
Titvlc.SetTextSize( 16 );
Titvlc.SetMargins( 0.15, 0.01, 0.01, 0.01 );
Vlc.AddChild( Titvlc );
//txtpara guardar el archivo
Txtar = app.CreateText( "Nombre del Archivo:" );
Txtar.SetTextColor( "#000000" );
Txtar.SetTextSize( 12 );
Txtar.SetMargins( 0.025, 0.01, 0.01, 0.01 );
Tedna = app.CreateTextEdit( "",0.5,0.040 );
Tedna.SetTextColor( "#000000" );
Tedna.SetTextSize( 12 );
Tedna.SetMargins( 0.30, -0.04, 0.01, 0.01 );
Vlc.AddChild( Txtar );
Vlc.AddChild( Tedna );
//Selección del tipo de atchivo y cuestionario
var Txc = "<u>Tipo de Cuestionario:</u>"
var Txp = "<u>Tipo de Pregunta:</u>"
Barrah = app.CreateImage( null, 0.9,0.01 );
Barrah.SetPaintColor( "#000000" );
Barrah.DrawLine( 0.0,0.1,1.0,0.1 );
Barrah.SetMargins( 0.025, 0.0, 0.0, 0.0 );
Barrav = app.CreateImage( null, 0.01,0.2 );
Barrav.SetPaintColor( "#000000" );
Barrav.DrawLine( 0.0,0.1,0.0, 0.8 );
Barrav.SetMargins( 0.35, -0.12, 0.0, 0.0 );
//titulo 1
Txtc = app.CreateText( Txc,0.3,-1,"Html" );
Txtc.SetTextColor( "#000000" );
Txtc.SetTextSize( 12 );
Txtc.SetMargins( 0.02, 0.0, 0.0, 0.0 );
Rbtc1 = app.CreateCheckBox( "Encuesta" );
Rbtc1.SetTextSize( 12 );
Rbtc1.SetMargins( 0.02, 0.0, 0.0, 0.0 );
Rbtc2 = app.CreateCheckBox( "Examen" );
Rbtc2.SetTextSize( 12 );
Rbtc2.SetMargins( 0.02, 0.0, 0.0, 0.0 );
// Segundo título
Txtp = app.CreateText( Txp,0.3,-1,"Html" );
Txtp.SetTextSize( 12 );
Txtp.SetTextColor( "#000000" );
Txtp.SetMargins( 0.35, -0.181, 0.0, 0.0 );
// RadioButtons
// Rbtp1
Rbtp1 = app.CreateCheckBox( "INR" );
Rbtp1.SetTextSize( 12 );
Rbtp1.SetMargins( 0.38, 0.0, 0.0, 0.0 );
// Rbtp2
Rbtp2 = app.CreateCheckBox( "IRM1R" );
Rbtp2.SetTextSize( 12 );
Rbtp2.SetMargins( 0.38, 0.0, 0.0, 0.0 );
// Rbtp3
Rbtp3 = app.CreateCheckBox( "IRMMR" );
Rbtp3.SetTextSize( 12 );
Rbtp3.SetMargins( 0.38, 0.0, 0.0, 0.0 );
// Rbtp4
Rbtp4 = app.CreateCheckBox( "RM1R" );
Rbtp4.SetTextSize( 12 );
Rbtp4.SetMargins( 0.58, -0.09, 0.0, 0.0 );
// Rhtp5
Rbtp5 = app.CreateCheckBox( "RMMR" );
Rbtp5.SetTextSize( 12 );
Rbtp5.SetMargins( 0.58, 0.0, 0.0, 0.0 );
//barrah2
barrah2 = app.CreateImage( null, 0.9,0.01 );
barrah2.SetPaintColor( "#000000" );
barrah2.DrawLine( 0.0,0.1,1.0,0.1 );
barrah2.SetMargins( 0.025, 0.03, 0.0, 0.0 );
//ID Cuestionario
Txid = app.CreateText( "ID del Cuestionario:" );
Txid.SetTextColor( "#000000" );
Txid.SetTextSize( 12 );
Txid.SetMargins( 0.03, 0.0, 0.0, 0.0 );
//texto que muestra el id autogenerado
Txidd = app.CreateText( " " );
Txidd.SetTextColor( "#000000" );
Txidd.SetTextSize( 12 );
Txidd.SetBackColor( "#7f7f7f" );
//Txidd.SetText( "12" );
Txidd.SetMargins( 0.30, -0.027, 0.0, 0.0 );
//opcion para imprimir numeros
Tximpn = app.CreateText( "¿Imprimir Números?" );
Tximpn.SetTextSize( 12 );
Tximpn.SetTextColor( "#000000" );
Tximpn.SetMargins( 0.35,- 0.03, 0.0, 0.0 );
//spinner de los números
l="Sel,0,1,2";
spn = app.CreateSpinner( l,0.12 );
spn.SetTextSize( 12 );
spn.SetTextColor( "#000000" );
spn.SetMargins( 0.43,-0.0,0.0, 0.0 );
//Opciones
Txop = app.CreateText( "Opciones:" );
Txop.SetTextSize( 12 );
Txop.SetTextColor( "#000000" );
Txop.SetMargins( 0.70, -0.07, 0.0, 0.0 );
//numerador
var n=100;
var l2="";
//estas opciones deven de leer los números de orden ya programados y excluirlos de la lista en cada cambio
for(var i=1;i<=n;i++){
if(i==n){
l2=l2+ new String(i);//
}else{
l2=l2 + new String(i) +",";//
}
}
num = app.CreateSpinner( l2,0.12 );
num.SetTextSize( 12 );
num.SetTextColor( "#000000" );
num.SetMargins( 0.70, 0.0, 0.0, 0.0 );
//texto indicativo de la pregunta
Tp = app.CreateText( "Escriba la pregunta " );
Tp.SetTextSize( 12 );
Tp.SetTextColor( "#000000" );
Tp.SetMargins( 0.025, -0.03, 0.01, 0.01 );
//text area para capturar la pregunta
Ta1 = app.CreateTextEdit( "",0.9,0.15,"Left Bold" );
Ta1.SetTextSize( 12 );
Ta1.SetTextColor( "#000000" );
Ta1.SetBackColor( "#33ffffff" );
Ta1.SetMargins( 0.025, -0.01, 0.01, 0.01 );
//srparador horizontal
barrah3 = app.CreateImage( null, 0.9,0.01 );
barrah3.SetPaintColor( "#000000" );
barrah3.DrawLine( 0.0,0.1,1.0,0.1 );
barrah3.SetMargins( 0.025, 0.0, 0.0, 0.0 );
//texto para escribir las respuestas
Tr = app.CreateText( "Escriba la Respuesta " );
Tr.SetTextSize( 12 );
Tr.SetTextColor( "#000000" );
Tr.SetMargins( 0.025, 0.0, 0.01, 0.01 );
//indicador de respuestas
Ir = app.CreateText( "Respuestas: " );
Ir.SetTextSize( 12 );
Ir.SetTextColor( "#000000" );
Ir.SetMargins( 0.65, -0.038, 0.01, 0.01 );
//barra horizontal psra el número de Respuestas
Barrah4 = app.CreateImage( null, 0.5,0.01 );
Barrah4.SetPaintColor( "#000000" );
Barrah4.DrawLine( 0.0,0.1,0.21,0.1 );
Barrah4.SetMargins( 0.82, -0.01, 0.01, 0.01 );
//textedit para las respuestas
Txr = app.CreateTextEdit( "",0.9,0.15,"Left Bold" );
Txr.SetTextSize( 12 );
Txr.SetTextColor( "#000000" );
Txr.SetBackColor( "#33ffffff" );
Txr.SetMargins( 0.025, -0.01, 0.01, 0.01 );
//check respuedta correcta
Dfr = app.CreateText( "hola" );
Dfr.SetTextSize( 12 );
Chr = app.CreateCheckBox( "Respuesta correcta" );
Chr.SetTextSize( 12 );
Chr.SetTextColor( "#000000" );
Chr.SetMargins( 0.01, 0.01, 0.01, 0.01 );
//texto valor
Txv = app.CreateText( "Valor: " );
Txv.SetTextSize( 12 );
Txv.SetTextColor( "#000000" );
Txv.SetMargins( 0.01, 0.01, 0.01, 0.01 );
//text edit para capturar el valor de la respuesta correcta
Txtv = app.CreateTextEdit( "",0.1,0.04 );
Txtv.SetTextSize( 12 );
Txtv.SetTextColor( "#000000" );
Txtv.SetBackColor( "#33ffffff" );
Txtv.SetMargins( 0.03, 0.01, 0.01, 0.0 );
// Add to Vlc
Vlc.AddChild( Barrah );
Vlc.AddChild( Txtc );
Vlc.AddChild( Rbtc1 );
Vlc.AddChild( Rbtc2 );
Vlc.AddChild( Barrav );
Vlc.AddChild( Txtp );
Vlc.AddChild( Rbtp1 );
Vlc.AddChild( Rbtp2 );
Vlc.AddChild( Rbtp3 );
Vlc.AddChild( Rbtp4 );
Vlc.AddChild( Rbtp5 );
Vlc.AddChild( barrah2 );
Vlc.AddChild( Txid );
Vlc.AddChild( Txidd );
Vlc.AddChild( Tximpn );
Vlc.AddChild( spn );
Vlc.AddChild( Txop );
Vlc.AddChild( num );
Vlc.AddChild( Tp );
Vlc.AddChild( Ta1 );
Vlc.AddChild( barrah3 );
Vlc.AddChild( Tr );
Vlc.AddChild( Ir );
Vlc.AddChild( Barrah4 );
Vlc.AddChild( Txr );
Vlc.AddChild( Dfr );
Vlc.AddChild( Chr );//->not appear
Vlc.AddChild( Txv );//->not appear
Vlc.AddChild( Txtv );//->this appear
//Creando ventana aplica examen, encuesta
// Vlaplica
//Creando ventana califica examen, encuesta
// Vlcal
//Creando la ventana graficar
//Vlgraf
//Crate de first Spinner
sp = app.CreateSpinner("Seleccione:,Crear,Aplicar,Calificar,Graficar",0.25 );
sp.SetMargins( 0.01, 0, 0.01, 0 );
sp.SetOnChange( seleccion );
sp.SelectItem( null );
//Create a text label and add it to layout.
txt = app.CreateText( "Creador de Encuesyas y Exámenes V0.1 Alpha" );
txt.SetTextSize( 16 );
txt.SetTextColor( "#000000" );
txt1 = app.CreateText( "Menú " );
txt1.SetTextSize( 16 );
txt1.SetTextColor( "#000000" );
txt1.SetMargins( 0.07, 0.01, 0.01, 0 );
lay.AddChild( txt );
lframe.AddChild( txt1 );
lframe.AddChild( sp );
//Add layout to app.
app.AddLayout( lay );
lay.AddChild(lframe );
lframe.AddChild( Vlc );
}
function seleccion(sel)
{//ini seleccion
switch(sel){
case "Crear":
app.ShowPopup( "Entró a crear","short Bottom" );
Vlc.SetVisibility( "Show" );
//app.ShowPopup( Titvlc.GetWidth( ));
break;
case "Aplicar":
app.ShowPopup( "Entró a Aplicar" );
break;
case "Calificar":
app.ShowPopup( "Entró a Calificar" );
break;
case "Graficar":
app.ShowPopup( "Entró a Graficar" );
break;
case "Seleccione:":
app.ShowPopup( "Escoja una opción de la lista del combo!!!" );
break;
}
}//end seleccion
这会产生以下错误:
屏幕宽度问题缺失控制
你能帮我吗?
您需要将控件包装在滚动条中。
app.CreateScroller(w,h);
这样可以确保通过滚动可以看到视图之外的控件。