递归火山软件开发平台

标题: 怎么循环写入编辑框 [打印本页]

作者: kuen5200830    时间: 2023-3-24 22:05
标题: 怎么循环写入编辑框
本帖最后由 创世魂 于 2023-3-25 08:48 编辑

新人试着写一个双色球机选程序.
我生成了5组数据,每组有7个数组,分别要写入35个格子中,因为5组数据都是随机生成的,做了5次循环,但是怎么循环写入编辑框中就不会了.
如图中,
(, 下载次数: 17)
(, 下载次数: 21)

编辑框2.内容,,,,,,,怎么将这个2写成变量做这循环递增,这一步不会写了,
就不用写编辑框3.内容,,,,,编辑框4.内容   

就写循环递增编辑框
麻烦写个例子,谢谢




作者: Xelloss0618    时间: 2023-3-24 23:55
除非你的编辑框是动态创建,并用数组保存,否则是不支持循环设置内容的
作者: 创世魂    时间: 2023-3-25 08:46
Xelloss0618 发表于 2023-3-24 23:55
除非你的编辑框是动态创建,并用数组保存,否则是不支持循环设置内容的

可以的,可以通过取子组件实现,但是前提是组件顺序排序好。
作者: 创世魂    时间: 2023-3-25 08:47
上传图片不支持直接粘贴,要通过上传图片的按钮上传。。
作者: suyan    时间: 2023-3-25 08:56
不要上面的7个框,只要下面的大框,7个框里的数据,用变量,就容易多了
作者: 创世魂    时间: 2023-3-25 09:27
本帖最后由 创世魂 于 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)
    }
}



作者: kuen5200830    时间: 2023-3-25 18:03
感谢创世魂及各位的回复,我去试一下,
谢谢!
作者: kuen5200830    时间: 2023-3-25 19:41
创世魂 发表于 2023-3-25 09:27
ps:有了文本代码真方便。。

谢谢,按你的方法搞定了,[code][/code]




欢迎光临 递归火山软件开发平台 (https://bbs.voldp.com/) Powered by Discuz! X3.4