자동핫키의 목록 보기 상자에 양수 값과 음수 값을 별도로 나열하려면 어떻게 해야 합니까?

자동핫키의 목록 보기 상자에 양수 값과 음수 값을 별도로 나열하려면 어떻게 해야 합니까?

내 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에 다음 컨트롤을 추가하고 싶습니다.

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

두 개의 목록 보기 상자를 원하고 그 중에서 먼저 양수 값을 나열해야 하고 다른 하나는 음수 값을 나열해야 합니다. 왜냐하면 총계(세 번째 편집 상자에 %Newvar% 및 %Newv%의 총계가 표시됨)가 양수이면 다음과 같아야 하기 때문입니다. 양수 목록 보기 상자에 나열되고 총계가 음수이면 음수 목록 보기 상자에 나열되어야 합니다. 또한 네거티브 및 포지티브 목록 보기 상자 모두에 대해 no(일련 번호) 열이 있어야 합니다. 나는 음수 값의 수가 와야하고 다른 편집 상자에는 모든 음수 값의 합계가 와야하는 두 개의 편집 상자를 더 만들었습니다.

답변1

프로그램의 흐름은 다음과 같습니다.

  • GUI 1에서는 사용자가 항목을 입력하고 다음을 누르면 테이블에 추가됩니다.
  • GUI 2에서는 GUI 1 테이블의 항목이 테이블 A(Positives)와 테이블 B(Negatives)로 정렬됩니다.

다음과 같이 조정해야 할 것 같습니다.

  • GUI1의 경우 다른 버튼을 추가하여 GUI2로 진행합니다. 이것을 진행 버튼이라고 부르겠습니다.
  • 진행 버튼을 누르면...
  • GUI1 숨기기
  • 최종 GUI1 테이블의 모든 값을 반복합니다.
  • 각 값에 대해 음수인지 양수인지에 따라 GUI2 테이블 중 하나(또는 해당 테이블에 기록될 변수)에 추가합니다.
  • 모든 숫자가 해당 테이블로 처리된 후 GUI2를 표시합니다.
  • GUI2를 두 번째 GUI로 만들려면 위의 코드를 리팩터링해야 합니다(하나 이상의 GUI를 사용하려면 필요에 따라 도움말 파일을 참조하세요. 기본적으로 모든 명령 앞에 GUI 번호를 추가하면 됩니다).

관련 정보