AHK:GUI

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
inseption86
Posts: 206
Joined: 19 Apr 2018, 00:24

AHK:GUI

23 Feb 2023, 05:26

Good afternoon. How can I find out which "order and IsAnswer" is selected? and how to enable unselected buttons. Or maybe there is something on the example? Thanks in advance!

Code: Select all

#NoEnv
SetBatchLines, -1
#SingleInstance force


text1 =
(
 {"Question":{"ID":1001476,"TaskIdentifier":"C529EC"}, "QuestionUnits":[{"ID":1002597,"TypeID":1,"Text":"Choose the correct answer","Order":1},{"ID":1002598,"TypeID":1,"Text":"Capital of Argentina","Order":2}],"Answers":[{"ID":1003694,"TypeID":3,"Text":"Rio","IsAnswer":false,"Order":1},{"ID":1003695,"TypeID":3,"Text":"Moscow","IsAnswer":false,"Order":2},{"ID":1003696,"TypeID":3,"Text":"Buenos Aires","IsAnswer":true,"Order":3}]}
)

text2 =
(
 {"Question":{"ID":1001479,"TaskIdentifier":"22E13F"},"QuestionUnits":[{"ID":1002601,"TypeID":1,"Text":"Choose the correct answer","Order":1},{"ID":1002603,"TypeID":1,"Text":"capital of South Africa","Order":2}],"Answers":[{"ID":1003703,"TypeID":3,"Text":"Berlin","IsAnswer":false,"Order":1},{"ID":1003704,"TypeID":3,"Text":"Cape Town","IsAnswer":true,"Order":2},{"ID":1003705,"TypeID":3,"Text":"Ottawa","IsAnswer":false,"Order":3}]}
)

text3 =
(
 {"Question":{"ID":1001482,"TaskIdentifier":"1DBF31"},"QuestionUnits":[{"ID":1002601,"TypeID":1,"Text":"Choose the correct answer","Order":1},{"ID":1002606,"TypeID":1,"Text":"the capital of Australia","Order":2}],"Answers":[{"ID":1003712,"TypeID":3,"Text":"Canberra","IsAnswer":true,"Order":1},{"ID":1003713,"TypeID":3,"Text":"Mexico","IsAnswer":false,"Order":2},{"ID":1003714,"TypeID":3,"Text":"London","IsAnswer":false,"Order":3}]}
)


loop 3
 list_tab .=  "  " A_index "|"

Gui Testing: Font, S10 normal CDefault, Verdana
Gui Testing: Add, Tab2, % "AltSubmit x10 y+30 h50 Buttons -WRAP gTAB_BUTTON vTAB_BUTTON", % list_tab
loop 3
{
	random_quest(text%A_index%, vopros, upvopros, quest_%A_index%_1, quest_%A_index%_2, quest_%A_index%_3)

	Gui Testing: Tab, % A_index
	Gui Testing: Add, Text, x10 y+10 , % "Question " A_index ". " upvopros 
	Gui Testing: Add, Text, , % vopros

	Gui Testing: Add, Button,  x10 y+10  gButton, % quest_%A_index%_1
	Gui Testing: Add, Button,  x+10 gButton, % quest_%A_index%_2
	Gui Testing: Add, Button,  x+10  gButton, % quest_%A_index%_3
   
}
Gui Testing: Show, 
return

TAB_BUTTON:
return


Button:
GuiControl, %A_Gui%: Disable, % A_GuiControl
GuiControl, %A_Gui%: Enable, ?????????????????????
GuiControl, %A_Gui%: Enable, ?????????????????????

GuiControlGet, ThisTab,, SysTabControl321,  % A_Gui
PostMessage, 0x1333, % ThisTab-1, 1, SysTabControl321, % A_Gui

GuiControl, %A_Gui%: Choose, TAB_BUTTON, % ThisTab + 1

return

TestingGuiClose:
ExitApp


random_quest(random_path, ByRef vopros, ByRef upvopros, ByRef quest_1, ByRef quest_2, ByRef quest_3) { 
         
	obj := JSON.Parse(random_path)

	for key_quest, item_quest in obj.QuestionUnits
	{
		if (key_quest = 1)
			upvopros := item_quest.text
		if (key_quest = 2)
			vopros := item_quest.text
	}
      
	for key_answ, item_answ in obj.Answers
	{
		if (key_answ = 1)
		{
			quest_1 := item_answ.text
		}
		if (key_answ = 2)
		{
			quest_2 := item_answ.text
		}
		if (key_answ = 3)
		{
			quest_3 := item_answ.text
		}
    }
    
}

[Mod edit: Topic moved to v1 help.]

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: GEOVAN, Giresharu, Google [Bot], peter_ahk and 117 guests