johnnyboy 3742 Posted May 10, 2022 Hi gents. I want to make a group spawn selector GUI with two panels: On the left is the scrollable list of group names from an array I provide. As user scrolls through the list and highlights the group name, the big panel on the right will display a picture of the current group (I will have a JPG for each group) There will be two buttons: 1) 'Pick Group' will call a script passing in current selected group, and remove the GUI, and 2) a Cancel button to close GUI without selecting. GUI will be launched via an action. Is there a sample out there doing something very similar to this? Where you scroll through an array on the left, showing a related detail picture for selected array element on the right? I normally would dig into Soolie's tutorial video (I watched it) and other examples, but I really don't want to invest the time to become a GUI expert, as I have tons of other stuff to build. I've never really got into GUI stuff before. Also, I'm hoping it can be all done with code (like the icon viewer or @Larrow's sound sampler), and not require description.ext .hpp includes, etc., as that will complicate things for me. It will be worth it... 🙂 Share this post Link to post Share on other sites
dreadedentity 278 Posted May 10, 2022 Interesting requirements (restrictions?). GUI can be built with sqf-only but is a lot more tedious. Can't work on this now but will edit later. I can treat this like a speed challenge 😛 1 1 Share this post Link to post Share on other sites
johnnyboy 3742 Posted May 10, 2022 17 minutes ago, dreadedentity said: Interesting requirements (restrictions?). GUI can be built with sqf-only but is a lot more tedious. Can't work on this now but will edit later. I can treat this like a speed challenge 😛 Thanks man, but only do it if you have the time and interest. But I'll definitely appreciate it! Share this post Link to post Share on other sites
dreadedentity 278 Posted May 11, 2022 This script pretty much just teaches you how to make dialogs lol //data = /* DATA ARRAY GOES HERE [["GROUP NAME", "PATH TO PICTURE"],[],[],etc] */; data = [ ["test 1", "#(argb,8,8,3)color(1,0,0,0.5)"], ["test 2", "#(argb,8,8,3)color(0,1,0,0.5)"], ["test 3", "#(argb,8,8,3)color(0,0,1,0.5)"], ["test 4", "#(argb,8,8,3)color(1,1,0,0.5)"], ["test 5", "#(argb,8,8,3)color(0,1,1,0.5)"], ["test 6", "#(argb,8,8,3)color(1,1,1,0.5)"], ["test 7", "#(argb,8,8,3)color(0,0,0,0.5)"] ]; //#Tizuwo private _guiEditorOutput = [ 1.063, ["quickgui",[[0,0,1,1],0.025,0.04,"GUI_GRID"],0,0,0], [1500,"RscListBox",[1,"",["0.322812 * safezoneW + safezoneX","0.276 * safezoneH + safezoneY","0.137812 * safezoneW","0.224 * safezoneH"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]], [1200,"RscPicture",[1,"#(argb,8,8,3)color(0,0,0,0.5)",["0.467187 * safezoneW + safezoneX","0.276 * safezoneH + safezoneY","0.203437 * safezoneW","0.224 * safezoneH"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]], [1600,"RscButton",[1,"Pick Group",["0.322812 * safezoneW + safezoneX","0.514 * safezoneH + safezoneY","0.065625 * safezoneW","0.028 * safezoneH"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]], [1601,"RscButton",[1,"Cancel",["0.395 * safezoneW + safezoneX","0.514 * safezoneH + safezoneY","0.065625 * safezoneW","0.028 * safezoneH"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]] ]; disableSerialization; private _display = createDialog ["RscDisplayEmpty", false]; { private _control = _display ctrlCreate [_x # 1, _x # 0]; _control ctrlSetText (_x # 2 # 1); _control ctrlSetBackgroundColor [0,0,0,0.5]; _control ctrlSetPosition ((_x # 2 # 2) apply {call compile _x}); _control ctrlCommit 0; } forEach (_guiEditorOutput select [2, 4]); { lbAdd [1500, _x # 0]; } forEach data; (displayCtrl 1500) ctrlAddEventHandler ["LBSelChanged", { private _index = _this # 1; (displayCtrl 1200) ctrlSetText ((data # _index) # 1); }]; (displayCtrl 1600) ctrlAddEventHandler ["ButtonClick", { (lbCurSel 1500) call myScript; closeDialog 0; }]; (displayCtrl 1601) ctrlAddEventHandler ["ButtonClick", { closeDialog 0; }]; That should get you most of the way there 🙂 6 Share this post Link to post Share on other sites
johnnyboy 3742 Posted May 11, 2022 12 hours ago, dreadedentity said: That should get you most of the way there 🙂 That is a THOB! <thing of beauty!> Great template. Thanks a million, this really simplifies the whole concept for me. Thanks for getting me out of the gate! Share this post Link to post Share on other sites
dreadedentity 278 Posted May 11, 2022 No problem, can't wait to see what you're going to make with this 1 Share this post Link to post Share on other sites
johnnyboy 3742 Posted August 19, 2022 On 5/11/2022 at 8:26 AM, dreadedentity said: No problem, can't wait to see what you're going to make with this It's been a while, I hope you are doing well. I wanted to thank you again for the GUI Selector. I use it in my new SOG AI mod, which allows player to select a Prairie Fire group to spawn, and then play the PF campaigns with a helpful (it's true!) and immersive AI squad. The selector works great! I hope you get a chance to try the mod and see it in action. 3 Share this post Link to post Share on other sites
pierremgi 4739 Posted August 19, 2022 Yes nice! I'm trying to list all possible groups also (coming from cfgGroups) inside a module dialog (list and module dialog are not a problem). I can't just add a custom list (array variable) like I can add an hard coded combo box... The aim is NOT setting classes for all groups of an addon, but picking an array to make it as a droppable or scrollable list in this module menu. Any hints? Searching for days. Share this post Link to post Share on other sites
panther42 40 Posted August 19, 2022 5 hours ago, pierremgi said: Yes nice! I'm trying to list all possible groups also (coming from cfgGroups) inside a module dialog (list and module dialog are not a problem). I can't just add a custom list (array variable) like I can add an hard coded combo box... The aim is NOT setting classes for all groups of an addon, but picking an array to make it as a droppable or scrollable list in this module menu. Any hints? Searching for days. Not exactly certain I understand what you are asking, but here is a way I do it for extracting groups. Multiple ways to skin this one. Example is simple script which can be placed in mission folder and executed from wherever (debug console) PF is odd for some groups, as VN_MACV is all groups listed for faction B_MACV. Spoiler private _outCfgHash = []; private _cfgGrpSide = "West"; //enter side, or pull from dropdown, etc. private _cfgGrpFaction = ["VN_MACV", "B_CIA"]; //enter faction(s) or grab from dropdown, etc. private _factions = "((configName _x) in _cfgGrpFaction)" configClasses (configFile >> "CfgGroups" >> _cfgGrpSide); { // faction level _outFacNam = configName _x; private _groupTypes = "true" configClasses _x; { // groupType level private _groups = "true" configClasses _x; private _outCfgGrpHash = []; private _outCfgGrpTyp = []; private _outCfgGrpTypHash = []; _outCfgGrpHash pushback (_outFacNam + "_" + configName _x); //can be done other ways, but I like to see since there can be multiple factions with same type of group (if you select more than one) panther42 { // group level _outCfgGrpTyp pushback configName _x; _outCfgGrpTypHash pushback configName _x; //private _units = "true" configClasses _x; if you want units also... //{ // _output pushBack getText (_x >> "vehicle"); //} forEach _units; } forEach _groups; _outCfgGrpHash pushBack _outCfgGrpTypHash; _outCfgHash pushback _outCfgGrpHash; } forEach _groupTypes; } forEach _factions; private _myFilledMap = createHashMapFromArray _outCfgHash; _myFilledMap apply {diag_log [_x, _y]}; diag_log (keys _myFilledMap); And the output in log (for example): Spoiler ["VN_MACV_vn_b_group_armor_army",["vn_b_group_armor_army_01","vn_b_group_armor_army_02","vn_b_group_armor_army_03"]] ["VN_MACV_vn_b_group_armor_usmc",["vn_b_group_armor_usmc_01","vn_b_group_armor_usmc_02","vn_b_group_armor_usmc_03"]] ["VN_MACV_vn_b_group_men_lrrp",["vn_b_group_men_lrrp_01"]] ["VN_MACV_vn_b_group_mech_army",["vn_b_group_mech_army_01","vn_b_group_mech_army_02","vn_b_group_mech_army_03","vn_b_group_mech_army_04","vn_b_group_mech_army_05","vn_b_group_mech_army_06","vn_b_group_mech_army_07","vn_b_group_mech_army_08","vn_b_group_mech_army_09","vn_b_group_mech_army_10","vn_b_group_mech_army_11","vn_b_group_mech_army_12"]] ["VN_MACV_vn_b_group_men_seal_db",["vn_b_group_men_seal_db_01","vn_b_group_men_seal_db_02"]] ["VN_MACV_vn_b_group_motor_army",["vn_b_group_motor_army_01","vn_b_group_motor_army_02","vn_b_group_motor_army_03","vn_b_group_motor_army_04","vn_b_group_motor_army_05","vn_b_group_motor_army_06","vn_b_group_motor_army_07","vn_b_group_motor_army_08"]] ["VN_MACV_vn_b_group_men_cidg",["vn_b_group_men_cidg_01","vn_b_group_men_cidg_02","vn_b_group_men_cidg_03","vn_b_group_men_cidg_04","vn_b_group_men_cidg_05"]] ["VN_MACV_vn_b_group_static_navy",["vn_b_group_static_navy_01","vn_b_group_static_navy_02"]] ["VN_MACV_vn_b_group_men_army",["vn_b_group_men_army_01","vn_b_group_men_army_02","vn_b_group_men_army_03","vn_b_group_men_army_04","vn_b_group_men_army_05","vn_b_group_men_army_06","vn_b_group_men_army_07","vn_b_group_men_army_08","vn_b_group_men_army_09"]] ["VN_MACV_vn_b_group_air_navy",["vn_b_group_air_navy_01","vn_b_group_air_navy_02","vn_b_group_air_navy_03","vn_b_group_air_navy_04","vn_b_group_air_navy_05","vn_b_group_air_navy_06","vn_b_group_air_navy_07","vn_b_group_air_navy_08"]] ["VN_MACV_vn_b_group_men_seal_nad",["vn_b_group_men_seal_nad_01","vn_b_group_men_seal_nad_02","vn_b_group_men_seal_nad_03","vn_b_group_men_seal_nad_04","vn_b_group_men_seal_nad_05"]] ["VN_MACV_vn_b_group_boats",["vn_b_group_boat_01","vn_b_group_boat_02","vn_b_group_boat_03","vn_b_group_boat_04","vn_b_group_boat_05","vn_b_group_boat_06"]] ["VN_MACV_vn_b_group_air_usmc",["vn_b_group_air_usmc_01","vn_b_group_air_usmc_02","vn_b_group_air_usmc_03","vn_b_group_air_usmc_04","vn_b_group_air_usmc_05","vn_b_group_air_usmc_06","vn_b_group_air_usmc_07","vn_b_group_air_usmc_08","vn_b_group_air_usmc_09","vn_b_group_air_usmc_10","vn_b_group_air_usmc_11","vn_b_group_air_usmc_12"]] ["VN_MACV_vn_b_group_men_aircrew",["vn_b_group_men_cobra_01","vn_b_group_men_cobra_02","vn_b_group_men_cobra_03","vn_b_group_men_plane_01","vn_b_group_men_plane_02","vn_b_group_men_plane_03","vn_b_group_men_plane_04","vn_b_group_men_plane_05","vn_b_group_men_plane_06","vn_b_group_men_uh1_01","vn_b_group_men_uh1_02","vn_b_group_men_uh1_03","vn_b_group_men_uh1_04","vn_b_group_men_uh1_05","vn_b_group_men_uh1_06"]] ["VN_MACV_vn_b_group_air_army",["vn_b_group_air_army_01","vn_b_group_air_army_02","vn_b_group_air_army_03","vn_b_group_air_army_04","vn_b_group_air_army_05","vn_b_group_air_army_06","vn_b_group_air_army_07","vn_b_group_air_army_08","vn_b_group_air_army_09"]] ["VN_MACV_vn_b_group_static_sf",["vn_b_group_static_sf_01","vn_b_group_static_sf_02","vn_b_group_static_sf_03","vn_b_group_static_sf_04","vn_b_group_static_sf_05","vn_b_group_static_sf_06","vn_b_group_static_sf_07","vn_b_group_static_sf_08","vn_b_group_static_sf_09","vn_b_group_static_sf_10"]] ["B_CIA_vn_b_group_men_cia",["vn_b_group_men_cia_01"]] ["VN_MACV_vn_b_group_men_sog",["vn_b_group_men_sog_01","vn_b_group_men_sog_02","vn_b_group_men_sog_03","vn_b_group_men_sog_04"]] ["VN_MACV_vn_b_group_men_navy",["vn_b_group_men_navy_01"]] ["VN_MACV_vn_b_group_air_usaf",["vn_b_group_air_usaf_01","vn_b_group_air_usaf_02","vn_b_group_air_usaf_03","vn_b_group_air_usaf_04","vn_b_group_air_usaf_05","vn_b_group_air_usaf_06","vn_b_group_air_usaf_07","vn_b_group_air_usaf_08","vn_b_group_air_usaf_09","vn_b_group_air_usaf_10","vn_b_group_air_usaf_11","vn_b_group_air_usaf_12","vn_b_group_air_usaf_13","vn_b_group_air_usaf_14"]] ["VN_MACV_vn_b_group_static_army",["vn_b_group_static_army_01","vn_b_group_static_army_02","vn_b_group_static_army_03","vn_b_group_static_army_04","vn_b_group_static_army_05","vn_b_group_static_army_06","vn_b_group_static_army_07","vn_b_group_static_army_08","vn_b_group_static_army_09","vn_b_group_static_army_10"]] ["VN_MACV_vn_b_group_men_seal",["vn_b_group_men_seal_01","vn_b_group_men_seal_02","vn_b_group_men_seal_03","vn_b_group_men_seal_04","vn_b_group_men_seal_05","vn_b_group_men_seal_06"]] ["VN_MACV_vn_b_group_men_seal_udt",["vn_b_group_men_seal_udt_01","vn_b_group_men_seal_udt_02","vn_b_group_men_seal_udt_03"]] ["VN_MACV_vn_b_group_static_seal",["vn_b_group_static_seal_01","vn_b_group_static_seal_02","vn_b_group_static_seal_03","vn_b_group_static_seal_04"]] ["B_CIA_vn_b_group_air_cia",["vn_b_group_air_cia_01"]] ["VN_MACV_vn_b_group_men_sf",["vn_b_group_men_sf_01","vn_b_group_men_sf_02","vn_b_group_men_sf_03","vn_b_group_men_sf_04","vn_b_group_men_sf_05"]] ["VN_MACV_vn_b_group_armor_army","VN_MACV_vn_b_group_armor_usmc","VN_MACV_vn_b_group_men_lrrp","VN_MACV_vn_b_group_mech_army","VN_MACV_vn_b_group_men_seal_db","VN_MACV_vn_b_group_motor_army","VN_MACV_vn_b_group_men_cidg","VN_MACV_vn_b_group_static_navy","VN_MACV_vn_b_group_men_army","VN_MACV_vn_b_group_air_navy","VN_MACV_vn_b_group_men_seal_nad","VN_MACV_vn_b_group_boats","VN_MACV_vn_b_group_air_usmc","VN_MACV_vn_b_group_men_aircrew","VN_MACV_vn_b_group_air_army","VN_MACV_vn_b_group_static_sf","B_CIA_vn_b_group_men_cia","VN_MACV_vn_b_group_men_sog","VN_MACV_vn_b_group_men_navy","VN_MACV_vn_b_group_air_usaf","VN_MACV_vn_b_group_static_army","VN_MACV_vn_b_group_men_seal","VN_MACV_vn_b_group_men_seal_udt","VN_MACV_vn_b_group_static_seal","B_CIA_vn_b_group_air_cia","VN_MACV_vn_b_group_men_sf"] Forgot, and cut off the top of my script while posting. Cheatsheet: Spoiler // VN_MACV >> faction = "B_MACV" // B_CIA >> faction = "B_CIA" // VN_AUS >> faction = "B_AUS" // VN_NZ >> faction = "B_NZ" // VN_ROK >> faction = "B_ROK" // VN_PAVN >> faction = "O_PAVN" // VN_VC >> faction = "O_VC" // VN_PL >> faction = "O_PL" // VN_ARVN >> faction = "I_ARVN" // VN_RLA >> faction = "I_LAO" Also, that units part won't work as is, as I had removed some parts. Can be easily rectified 1 Share this post Link to post Share on other sites
pierremgi 4739 Posted August 20, 2022 6 hours ago, panther42 said: Not exactly certain I understand what you are asking, but here is a way I do it for extracting groups. Multiple ways to skin this one. Thks and good point for using hashmap. As I wrote, I neither have any difficulty for that nor building a module with combo boxes. The problem arises for displaying a list like you obtain in the module's menu. Combo boxes are "hard coded" with limited choices. a drop or scroll list coming from a variable (due to multiple possible active DLCs and addons) needs something more, but I don't want to alter johnnyboy's topic here. Share this post Link to post Share on other sites