Вот мой скрипт AHK:
Gui, Add, Edit, x77 y15 w100 h30 vMyvar gEdit1 ;first edit box, there can be entered any value.
Gui, Add, Edit, x237 y15 w100 h30 vNewvar Disabled, %Newvar% ;second edit box it shows the result by multiplying the first edit box's value by 100.
Gui, Add, Edit, x72 y60 w100 h30 vMyv gEdit2 ;third edit box, there can be entered any value.
Gui, Add, Edit, x242 y60 w100 h30 vNewv Disabled, %Newv% ;fourth edit box it shows the result by multiplying the second edit box's value by 50
Gui, Add, Edit, x242 y110 w100 h30 vTotal Disabled ;this edit box shows the total of %Newvar% and %Newv% i.e. second edit box and fourth edit box.
Gui, Add, ListView, x282 y200 w100 h300 , 100|50|total ;listview box which lists the values of first edit box and third edit box
Gui, Add, Button, x62 y120 w100 h30 gNext, NEXT ;next botton which when pressed lists the values of first edit box and third edit box and also clears the second edit box and fourth edit box everytime it pressed.
Gui, Show, w473 h373, Untitled GUI
return
Edit1:
Gui, Submit, NoHide
NewVar := Myvar * 100
GuiControl,, Newvar, %Newvar%
gosub, SetTotal
return
Edit2:
Gui, Submit, NoHide
NewV := Myv * 50
GuiControl,, Newv, %Newv%
gosub, SetTotal
return
SetTotal:
Total := 0
if NewVar is number
Total += NewVar
if Newv is number
Total += Newv
GuiControl,, Total, %Total%
return
Next:
Gui, Submit, NoHide
LV_Insert(1,, Myvar, Myv, Total)
Newvar := ""
Newv := ""
Total := ""
GuiControl,, Newvar, %Newvar%
GuiControl,, Newv, %Newv%
GuiControl,, Total, %Total%
return
Я хочу, чтобы в этот графический интерфейс были добавлены следующие элементы управления:
Gui, Add, ListView, x62 y170 w200 h300 , s no|100|50|total ; this listview box is for negative values and i added s no column also in it which should contain the serial no as the negative values are entered in this box.
Gui, Add, ListView, x282 y170 w200 h300 , s no|100|50|total ; same listview box for positive values.
Gui, Add, Text, x402 y20 w130 h20 , no of negative values
Gui, Add, Text, x402 y50 w130 h20 , total of negative value
Gui, Add, Edit, x542 y20 w100 h20 , ;in this edit box i want that there should come only the total no of negative values. say there are 10 nagative values in negative listview box then it should contain only no 10
Gui, Add, Edit, x542 y50 w100 h20 , ; in this edit box i want that it should contain the total of all the negative values i.e. if the total of all 10 negative value is say 50000 then it should contain 50000.
GuiClose:
ExitApp
так как я хочу два поля listview, и из них первое должно перечислять положительные значения, а другое должно перечислять отрицательные значения, так как итог (так как третье поле редактирования показывает сумму %Newvar% и %Newv%) положительный, то он должен быть указан в поле positive value listview, а итог отрицательный, то он должен быть указан в поле negative listview. Более того, должен быть столбец s no (серийный номер) также для обоих полей listview. Я сделал еще два поля редактирования, в которые я хочу, чтобы входило количество отрицательных значений, а в другом поле редактирования должна быть сумма всех отрицательных значений.
решение1
Похоже, что ход вашей программы выглядит следующим образом:
- В GUI 1 пользователь вводит элементы, нажимает «Далее», и они добавляются в таблицу.
- В GUI 2 элементы в таблице GUI 1 сортируются в Таблицу A (Положительные) и Таблицу B (Отрицательные).
Похоже, вам, возможно, придется внести следующие коррективы:
- Для GUI1 добавьте еще одну кнопку для перехода к GUI2. Назовем ее кнопкой Продолжить.
- При нажатии кнопки «Продолжить»…
- Скрыть GUI1
- Просмотрите все значения в вашей финальной таблице GUI1.
- Для каждого значения добавьте его в одну из таблиц GUI2 (или переменную, которая будет записана в эту таблицу) в зависимости от того, является ли оно отрицательным или положительным.
- После того, как все числа будут обработаны в соответствующих таблицах, покажите GUI2
- Вам нужно будет переработать код выше, чтобы превратить GUI2 во второй GUI (при необходимости обратитесь к файлам справки для использования более одного GUI — по сути, вам просто нужно добавить номер GUI перед всеми командами).