递归火山软件开发平台

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 火山 源码 类库

怎么循环写入编辑框

查看数: 2354 | 评论数: 7 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2023-3-24 22:05

正文摘要:

本帖最后由 创世魂 于 2023-3-25 08:48 编辑 新人试着写一个双色球机选程序. 我生成了5组数据,每组有7个数组,分别要写入35个格子中,因为5组数据都是随机生成的,做了5次循环,但是怎么循环写入编辑框中就不会了. 如 ...

回复

kuen5200830 发表于 2023-3-25 19:41:53
创世魂 发表于 2023-3-25 09:27
ps:有了文本代码真方便。。

谢谢,按你的方法搞定了,[code][/code]
kuen5200830 发表于 2023-3-25 18:03:36
感谢创世魂及各位的回复,我去试一下,
谢谢!
创世魂 发表于 2023-3-25 09:27:23
本帖最后由 创世魂 于 2023-3-25 09:29 编辑

ps:有了文本代码真方便。。


<火山程序 类型 = "通常" 版本 = 1 />

类 启动类 <公开 基础类 = 安卓5白色窗口 编辑时信息 = "C1FF3, 0, 0, 0">
{
    变量 按钮1 <类型 = 按钮>
    变量 线性布局器1 <类型 = 线性布局器 隐藏值属性 = "0"
            @安卓.窗口.布局 = "ctrl_id = 1\nctrl_order = 1\norientation = horizontal\np_layout_width_type = match_parent">
    变量 编辑框1 <类型 = 编辑框 隐藏值属性 = "0"
            @安卓.窗口.布局 = "p_horz_align = center_horizontal\np_layout_height_type = p_specified\np_layout_height_value = 40\np_layout_width_type = p_specified\np_layout_width_value = 40\np_vert_align = center_vertical\nparent_id = 1">
    变量 编辑框2 <类型 = 编辑框 隐藏值属性 = "0"
            @安卓.窗口.布局 = "ctrl_order = 1\np_horz_align = center_horizontal\np_layout_height_type = p_specified\np_layout_height_value = 40\np_layout_width_type = p_specified\np_layout_width_value = 40\np_vert_align = center_vertical\nparent_id = 1">
    变量 编辑框3 <类型 = 编辑框 隐藏值属性 = "0"
            @安卓.窗口.布局 = "ctrl_order = 2\np_horz_align = center_horizontal\np_layout_height_type = p_specified\np_layout_height_value = 40\np_layout_width_type = p_specified\np_layout_width_value = 40\np_vert_align = center_vertical\nparent_id = 1">
    变量 编辑框4 <类型 = 编辑框 隐藏值属性 = "0"
            @安卓.窗口.布局 = "ctrl_order = 3\np_horz_align = center_horizontal\np_layout_height_type = p_specified\np_layout_height_value = 40\np_layout_width_type = p_specified\np_layout_width_value = 40\np_vert_align = center_vertical\nparent_id = 1">
    变量 编辑框5 <类型 = 编辑框 隐藏值属性 = "0"
            @安卓.窗口.布局 = "ctrl_order = 4\np_horz_align = center_horizontal\np_layout_height_type = p_specified\np_layout_height_value = 40\np_layout_width_type = p_specified\np_layout_width_value = 40\np_vert_align = center_vertical\nparent_id = 1">
    变量 编辑框6 <类型 = 编辑框 隐藏值属性 = "0"
            @安卓.窗口.布局 = "ctrl_order = 5\np_horz_align = center_horizontal\np_layout_height_type = p_specified\np_layout_height_value = 40\np_layout_width_type = p_specified\np_layout_width_value = 40\np_vert_align = center_vertical\nparent_id = 1">
    变量 文本框1 <类型 = 文本框 隐藏值属性 = "0"
            @安卓.窗口.布局 = "ctrl_order = 6\np_horz_align = center_horizontal\np_layout_height_type = p_specified\np_layout_height_value = 40\np_layout_width_type = p_specified\np_layout_width_value = 40\np_vert_align = center_vertical\nparent_id = 1\ntext = \"--\"">
    变量 编辑框7 <类型 = 编辑框 隐藏值属性 = "0"
            @安卓.窗口.布局 = "ctrl_order = 7\np_horz_align = center_horizontal\np_layout_height_type = p_specified\np_layout_height_value = 40\np_layout_width_type = p_specified\np_layout_width_value = 40\np_vert_align = center_vertical\nparent_id = 1">

    方法 按钮_被单击 <公开 事件接收 类型 = 整数 编辑时信息 = "7AFF8, 0, 0, 0">
    参数 来源对象 <类型 = 按钮 编辑时信息 = "7AFF8, 0, 0, 0">
    参数 标记值 <类型 = 整数 编辑时信息 = "7AFF8, 0, 0, 0">
    {
        如果 (来源对象 == 按钮1)
        {
            变量 整数数组 <类型 = "整数 []">
            整数数组 = 随机数_取整数不重复 (1, 36, 6)
            计次循环 (取数组成员数 (整数数组))
            {
                变量 组件 <参考 类型 = 窗口组件>
                组件 = 线性布局器1.取子组件 (取循环索引 ())
                如果 (组件 != 空对象 && 组件 属于 编辑框)
                {
                    ((编辑框)组件).内容 = 到文本 (整数数组 [取循环索引 ()])
                }

            }
            编辑框7.内容 = 到文本 (取整数随机数2 (1, 16))

        }
        返回 (0)
    }
}


QQ截图20230325092620.png (12.03 KB, 下载次数: 16)

QQ截图20230325092620.png
suyan 发表于 2023-3-25 08:56:49
不要上面的7个框,只要下面的大框,7个框里的数据,用变量,就容易多了
创世魂 发表于 2023-3-25 08:47:18
上传图片不支持直接粘贴,要通过上传图片的按钮上传。。
创世魂 发表于 2023-3-25 08:46:26
Xelloss0618 发表于 2023-3-24 23:55
除非你的编辑框是动态创建,并用数组保存,否则是不支持循环设置内容的

可以的,可以通过取子组件实现,但是前提是组件顺序排序好。
Xelloss0618 发表于 2023-3-24 23:55:55
除非你的编辑框是动态创建,并用数组保存,否则是不支持循环设置内容的

QQ|Archiver|手机版|小黑屋|递归火山软件开发平台 ( 鄂ICP备18029190号 )

GMT+8, 2024-9-8 10:30 , Processed in 0.092423 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表