Form1 Form1 0 0 398 341 Key=>Value ComboBox image0 _a[1] = "red" _a[3] = "blue" _a[5] = "green" foreach i in _a do ListBox1.insertItem(i+"\t"+_a[i], -1) end ScriptObject36.execute AboutDialog1.initialize("Key Value Combo", "", "0.1", "Copyright 2008") AboutDialog1.addAuthor("Eric Laffoon", "Designer", "eric@kdewevdev.org", "http://kittyhooch.com") AboutDialog1.setBugAddress("eric@tdewebdev.org") AboutDialog1.setHomepage("http://tdewebdev.org") AboutDialog1.setLicense("GPL_V2") AboutDialog1.setDescription("This demonstrates how to make a ComboBox \n behave as a key value pair. It's \nparticularly useful for databases.") PopupMenu1.insertMenuItem("Make new list", "PopupMenu1", 1) PopupMenu1.insertMenuItem("Remove Item", "PopupMenu1", 2) PopupMenu1.insertMenuItem("Move Item up", "PopupMenu1", 3) PopupMenu1.insertMenuItem("Move Item down", "PopupMenu1", 4) PopupMenu1.insertSeparator(5) PopupMenu1.insertMenuItem("Remove Item from both", "PopupMenu1", 6) PopupMenu1.insertMenuItem("Insert Item in same location", "PopupMenu1", 7) PopupMenu1.insertSeparator(8) PopupMenu1.insertMenuItem("Quick Help", "PopupMenu1", 9) PopupMenu1.insertMenuItem("Help About", "PopupMenu1", 10) true unnamed 11 6 Layout27 unnamed 0 6 Label18 4 5 0 0 Select value ComboBox10 Layout30 unnamed 0 6 ListBox1 Right click for menu Layout24 unnamed 0 6 Label17 5 4 0 0 value LineEdit2 Layout23 unnamed 0 6 Label16 5 4 0 0 Key LineEdit1 ExecButton28 4 4 0 0 image1 ListBox1.insertItem(LineEdit1.text+"\t"+LineEdit2.text, -1) Layout31 unnamed 0 6 StatusBar5 AboutDialog1 ScriptObject36 image2 array_clear("_a") array_clear("_b") c = ListBox1.count-1 ComboBox10.clear for i = 0 to c do array_indexedFromString("x", ListBox1.item(i)) if str_length(_a[x[0]]) > 0 then message_error(x[0]+" is a duplicate key. Value \""+x[1]+"\" will not be inserted.") else _a[x[0]] = x[1] _b[i] = x[0] ComboBox10.insertItem(_a[_b[i]], i) endif end ScriptObject35 image3 i = Self.Item(0) StatusBar5.insertItem("index: "+i, 0) StatusBar5.insertItem("key: "+_b[i], 1) StatusBar5.insertItem("value from key: "+_a[_b[i]], 2) PopupMenu1 m = Self.Item(0) if m == 1 then //new list ScriptObject36.execute elseif m == 2 then // remove ListBox1.removeItem(ListBox1.currentItem) elseif m == 3 then // move up i = str_toint(ListBox1.currentItem) val = ListBox1.item(i) ListBox1.removeItem(i) ListBox1.insertItem(val, i-1) elseif m == 4 then //move down i = str_toint(ListBox1.currentItem) val = ListBox1.item(i) ListBox1.removeItem(i) ListBox1.insertItem(val, i+1) elseif m == 6 then //remove both ListBox1.removeItem(ListBox1.currentItem) i = ListBox1.currentItem ComboBox10.removeItem(i) array_indexedRemoveElements("_b", i) elseif m == 7 then //insert in postion i = ListBox1.currentItem array_indexedFromString("x", ListBox1.selection) if str_length(_a[x[0]]) > 0 then message_error(x[0]+" is a duplicate key. Value \""+x[1]+"\" will not be inserted.") else ComboBox10.insertItem(x[1], i) _a[x[0]] = x[1] array_indexedInsertElements("_b", i, x[0]) endif elseif m == 9 then //help message_info("Look in the dialog initialization first. Middle click in design mode. Make sure you click on an item when doing specific things in the menu. You can recreate the arrays or add or remove from them using the menus. Look at the menu widget and the script with the check on it to see how it's done.\nThe values you see in the StatusBar are generated from arrays and never access the ComboBox. All information is generated from arrays and the ComboBox index.\nDon't forget to try adding items with duplicate keys and duplicate values and see what happens.") elseif m == 10 then //help about AboutDialog1.execute else message_error("Unrecognized menu action "+m) endif 789ca598d94f1fc911c7dff7af40db6faba877a667baa747511e8c01e3030c06cc11e5a1aa7a86cbdc603051fef734f5ad9fed5d2952a4f521fba3beeaae1a7eff6de9606b63e9b7df7fb9bba7fb53599213ba5dfaad3c5c5c7cfbe7bffef1ef5f7e0d61a9fee9425e0abffeed975fb7ef976469f3ea727a013f56708dfe7a61597069b372068729f6cabbe0dcc8acbc622c4599c1a10dad72f1ca5d1370bfc77d5dcb01e70770176252de51eebb1c21df96720c6d87f51edcd3202fec5e29a7c01dee3b541e43dfa9b2ee4699dbd88e2a0f2997861a5d97040ed441dfa83c776d8ff5a3176e9b466cff6be5b6ded7aabe07ca5d37f6f4c2f400ee1bc84f1f95fb2859d7654f39a6766495c729a7b66d3a5dc77d431fa2ca2b9f9573ecb2ae975999dafa80ae5f1a0f0df6ef83fb79507bf927701e65d0f39372b507cef3837102fb2be3a1d1fd1efb4b65f87f193c3454f4fcaaf294a3e8ba6b5e3834ed88f3a528b72d352a0fef1b33e4f5df9443655d776aefd02d582e94fb568c3be3b9813ddf2a577b6695df6d1bf3a8f662514eed64fa7c521e6a38ea79867c39b48dfa9f8e95c705fb1f0c79d55f8142d7a8feee1a9cbaacfafb013c24d8c7df29f398912fee8db2c431e17d562ea137ff41be52eda9f2ca15784c05f10e7da7ba5fe5e3afc6b1d1789333f0200cff6e2acf21415f4fc643837cd5f8ace99971de6bfe756d65bc770aee52d0f8e77be550d7555efe0c4e09f1e95ae52e8c382fe7e0ae4680aeef832345e4eb2a788cd08f351fbb18b8d1fc70deb858bee1be983bc67b9aef55ba453c6d1b4b8b7a73094e7d823d37c15944f575b7ca43985ae4f7163813d6f98b71417c7bd82b6766c8ff9d8bbe479a9fdd1826e8ef173c9bfc199c02e4f167e09c08f1fb4e9916e749c0718c6a0f817e9ce70279b5fe75656c0bce6bfdeea6b1401e79569ec750903fa7c65dd1f749fdd7b75d84bd68cf3899bc1d38ce51f7b3c64f1f6a81837f37c0fdd4e9fb45e3b9efbb01f6a457c6638bf7efc07966c4eb9a721c09fef7e0347403de3b048f52501fd51ffdd091f94beb479fc75c50bfb5fef463c7886f5f8ca5457d5a07f78dc973021e479ca76cccd6dfde1897a2f92cd7df19f9f200e66e02639d3a8b57ff15cc11eb1c94b9ea83fc1fc1d4a27ffa4730e709f9a9fda697b117f873dd7886bd44fb5b5f16e759e3a79faa01105ff7604eb8af683cf573df427fd27c8c4ddfc05ea2fe8b6dead0cfbcde17bb61863fc4836998d05fb53ebdb4e309f5f69371467cb1d6c318fb8c7940b41fc594ad3e8bda230ebdc59fc3f9816982fce7606967f85bf329e6aa2fcedf1a0f93dadbad19cf13f255e3258e6326f81ffa513fb6e89fc7600a45f38b5be3cee23119cf13ea9dc67be47a5edff747e034637e21cdafda0c09eb0c798426d88b36c1dc9a7c9067ea6dde7207e03a5ea01fdc1bd714d3f31a4f351bfb80fe7e011ed3a8f672cf606a102facf1949a7ec67d740fe61efef26aff3a8d7419f553e33d853a70a1bf6b7ca5eaff84fa7c09e63a10eafe689c2dbe351f534fc4e87f9b6066cb8ff7c613e291d4be29d6fc80fe97c684fda4fd28a52a0fe6870b70951ff1a5f99e061a11ffe2c0dfe5db302e33fa81ceaf29c7087bf30c1e53863c03b8ca83fa087dc6d8e37dbf0c669970df0765926646bdd478484c05eb0c7b72f537e261c738435fdf8317e77d671c26d85ffb7d7a891f5d27e823d59ee8075a8f53a9fae2fd2be31efa5334a609fd17f217e9cc7eda4fd2944a07be06d7fbd0efcf8c05e7a9372e789fb51ea5991bab072acfd04446fcc83b6369e1ff67e3a9457e9d825313109f5bc66d40fdd1fe31b4291beb7b43a8e7f57eeac0d2c05e148c5bc48fcbc619f6259d67872ece013c82ebf8827ab307ce92d45fa4fd63e853ead01fb51e0fb1be8f7e7108ce39a1be607fa49170ff07f0c29feec27898314f6bbd1952b4fc746aef614813be47dc399832a17edc81a5b7fcb9361e511f59fd33e4dabe21df93710c88e7b7e0fa3ee4d37a338ca9833dbc185bbde1c9389abd9e8d5340fdb835ce01f322de1f47ca8807cdf781d380fa4f2b0b0e88cf2fe03aeec1deb65fac5f11e247aaffd01fb4df0ea59e473eed826b3d417d867da6349a7c37c6847ac94fc605eb04f9a76a3fdc8ff89917e769d7d8ced3155826f88f35bf7293d8d64f8ca780786fc143d3a17e1b2fdea31b63863f44e325b7f53eb59fc77dede2bc4ce04c09f6d57a9043ae21a8f2ec81ab3de0ff75b0c80c7be1fe2e31fce1ee8d05f9e4eec0436bf1cee05a2f50ff347e725fc73bc4db7be301f2b947b044f467a7f37dfd9a317b91379e218f837e491af45fa7f3681eaaff11af3a0fe43c04c4179f82c5fa0d69bdafd3fae23eed8f99eb38827eb40c9638213ebf804b67fb35de6b3a0c01f543f3af0e2f09f586b51ee56960e4a3877c53e94d9fcbef8cefd7c138ce9897609f3a3d05f8e7192cd6df58e51fdb41ccde6b6059f40fad7f6390d1ea19f6f7b9ef313fbc06978cf748eb6ffd5a0ce66f9d6fea746cf313a93feab8dbf69837b57fd66c8df6f31331ce3df245fd33723d8ff96ad378b07eba62cc33ea95c6d72839a19ed2b231c11f74042ec9eedb3266c8ef57bf33ecadf5b54ebb56df48e38b9a2c3de637adb7d48e8dfdfca50117abaf7edf58709f68fda0900bf4753be0ba8efea7f580fa3ce1e73f746e3cf78897042ec5f455fd292e5834fe285579b05ffb130d63077fc9a371847d49e7833abd14bcef3e1acf33fa81e63351b507f24feb35f1d4d8bafabf7eac36789f35bfa88cf58341d7b57ed15426bb7f024f2dce93f6a33add2e58e781fa315d2750dd1fc153b0f7745eaa5f3b61c63ca1f5f4659a34d678abd3d382757eaa5f1fc6dbf7ffffefbfb6df3b4ffa2f7bf1c54ff57fb33ffe5ffbfdb13ff1a7fecc9ffb2ffec25ffa2b7fed6ffcadbff3f7fec17ff58ffee90ffbbff967ffca2ffbd77ec5affa35ffc6affbb7fe9d7fef3ff80dbfe93ffaadc57ebfed3ff91dbfebf7fc67bfef0ffca13ff28d6f7df09def7df4c90f3efb11fb9d77ce916327aeb8c9cdeed89db85377e6cedd1777e12edd95bb76377e5cc8ef6edd9dbb770feeab7b744fee5bfdfbec5eb965f7daadb855b7e6deb875f7f6677ddd3bf7de7d701b6eb3defed16db96df7c9edb85db7e73ebb7d77e00eddd18ffdae71ad0bae73bd8b2eb9c1e55a1e3cd5982426a15207cb998e7feca7133aa5333aa72f7441977445d77443b77447f7f4405fe9919ee81b3dd3abeffb97e935add02aadd11b5aa7b7f48eded307daa04dfa485bb44d9f68877669effbfecfb44f07744847d4504b813aea2952a297196964cf8e8999e587beb5384d3cf3319ff0299ff1397fe10bbee42bbee61bbee53bbee7871ff2f3577ee427fec6cffc8a97f935aff02aaff11b5ee7b7fc8edff307dee0cd9ff67fe42ddee64fbcc3bbbcc79f799f0ff8908fea44d372e08e7bae9f873fdb9f07ae9fbfe2c509098b4891496639961339953339972f72f1f37eb9942bb9961bb9953bb99707f92a8ff224dfe4595ed513cbf2fa8ff12c2bb22a6bf246d6e52d277927efe5836cc8a67c942dd9964fb2f3a7fdbbb2279f655f0ee4508ea491568274527bb8241924cbf8e77cf1a31f8b2faed40c2b5c84e652eaffa632ffa5fcfdcfdf7ff92f64b3cec5 789c65cecf4a03311006f0fb3e45d8dc1649773766db223e82d2a3201ef26fb25b680b5a0f22be7bf3cd547b7008617e99907cab4ebdec9e54b76a3ecefebc441567ffaebaf479387cbdbe3d7e37ed30aaeb6aef9ad6a8a89e4fc78c7eaebdeeb94062a6c1093338f6d60a0b6827779d26d05b226160baca09f4609888ec3da8c154a79b00ee41eac9650746e640eb6cc18539d2364b6063b40fc1ebdab0a34f5c3e8ac19c71c0d6981161d71ce566cf496f0ee232731571bd5f84721fef15a6bcc7ff95f2f79f597ef3eccdbfbc3f0fcd05558f6aff 789ccdd4c94e1b411006e03b4f61513714fd999e7d14e510b22f10d60412e5d0b3b1180301033651de3dedeebfc8c2964ba4a8b1e5cf2e66aaaa6bfae1c2606b6569b0f070ee746cc77bcda0d9b5278385f66c349a7efef2f8dbdc7c1c0fdc5fe5dee71fcccdaf8e07cd60f9e8b09b41260e1245591d45de2774435fd02d7d189cc7f4573aa58774498fe88abea4f57a3b7447ef071711ddd0397d4e17c1c868cdbfa6993f22baa73f0597bc3eb669436fd25a9fa513febe4c67f412cdfcf09ed6fcded0ec073668f603af69cbfb1dd3ac078bb4d6f39466fff08466ffc0fd2cb5de57c195d6c7fdad581fb87f95d6774a733f71446bbd9c874aebe37e555a0ff7bf623dd8a3b51ece43a5f5709e2aada7a335ff36d8ea7ef5b4d693d37aff2ab8d6f99bd23a7facafd67c4c70a3f37646ebf54b9af5ca98d6ebefd23acfec57cbff17d6d3eafc1ed0badf42b35e61bf3aee87b0de8efd17f6a3d3e713b4ee7f11dceb3ca6dec6cd9bf10ecf93b9eadf5670d3f3f715efd8cd8f3f2c109ecfc4eabc7c086e8b28f18ebd5377bfd4fb9977e6e625f34e82bb9cfe18dc7774e85f6e75be427f4b371fa577e89775f7b7deebde75d545b577e85f6775de566736a6494da8c73fbf26b13a6f2fbd539b9890af7fde4c612b53784f694bfbf3c49456e7f15d709b9890dfdaccae5d651cfcdcbb6a8ab8f27eeb5df7451cf2f5e757dcd579eccf5ff8f330c9db2cc9bdfdfca55153a7e17e2f66cea2de645138bcff7efd3ff1105884fa1bb4f7c476e8b1e3d66e383fdcdabf35761f431cb888110e433e38c2b17b7dbd21f604a718e30ce7eef70bcd1f134c71892758fc2d76114ff10ccff1022f5dc4ab9ff5e235dee02ddeb9f725c62ee33d56b08a35f7fd3a36feec0f36f1011fb1856d7c42e45e1b3088dd3709526c5eef2732e428dc2adda74d54829944c44a7d53ffa5915a5abf3ae9c32718f75d73db7ec98eeccadecfe5eeb12337f4f82a7e885e0e7461284319dd350f72e8723ae23a76ba61377e9f1f39915319cb999cbb4f17f7cf9b4c5c165397f54426b74fd2aff172e9d61db1d7e2efbcf29ff17fb7fe79fcf747733f00356088d2 789c8597595315c912c7dffd1484f9664ce49cdebbe3c67d90d50de4282078631eb2360105140e224ecc77bfd9ffac3e23e08c9d3cf08bccaacacaade0f7272b87bbdb2b4f7e7f74b590c5895ff1c772b9f2245c9f9dddfeef8ffffef9e87159aee84f31cc56cac7bf3d7a3c5facf8959d8bf338021d29d00cdfc8720b2e542ae8e7e072949199c0d528b0b7f5f528b06f963c80df2c5960df82db51a0df5d72009bbe53817ff21ddcab789cbfbb64d8cb97890bf3ff39d88d023e9db8e8c1761f3f0af6337d9885ac7fb664f3ff1b38cd5281fdf8e3c863788a068cf38ab2284bdc9f6fc05dd195f08fdf83fba237a643b0145261bda66a6457b8cae27101f685373df7e054a4cae2e7976cf9c3fee54c39813f1897b30afe12ee53d6655d233eb4056ecbb6b6fd709f3294a1b1fb07702c63637ae4b34c65aa3a30d657755537603e59b2d9235ed5500d2de227f0af72a3c0fe353856b1b3780958bd6f0ad87723a39c2c9f88575da8d87dea893b9c4fd84f8faf3acb37eaa36e55101ffe3a716ffb6f82877a68917f7a3b718ffa263b5f6ae92d3f1b6057bbd6f6433c9ba22907ab77d46753a958bdae83eba636ffe43358bfdef27533f160fdf3142c8d74761efaa5892ac8a7e0be4d6a526bf1fb34f2d82e1de2cdc7130f60c27e6dd55683e5730dac5f6f8c7cb55ddb89c5e30aacd912e819f96ba595def27b94d90bfc6107f6adefadff5e80938addbf1ab92b552c5fefc04dd73a8bef0cdc769d43fc6415dc77bdf9cfd7e0a0ed6ef306f5dca5be70163ff4dbd8eecef6dfcc5c9a9ee18fb65b61f1a5f3cc95b77a2ac1ad0af22ff0a71f3f8b1ff2d50f8a56cf2eb338bb3feaa3973e7acb47028761e6adde8b9187b1012cff37137bebe79dcc7d0013d68fe517900f467f0f8d9627e6016f6576c1f281fed474f5dee657cc3c78ab17d4c7d0a91efef0197818c4f623cccbc10dc1ecf925d80f31fb8f7ce9782a9cd5e302ac05ea2dfea837e9a4cbe7215fa201c91c330fc1ea1bfd278332e2cfb69fb859447e05fd2b4e9cb3fbdd660ec1f2bb074eae3066e453c7651badff185cba2aa07e69277313ec7ec887b66f637a467fb9c649b4f30670ab62f3683e71de0ffeb84ec5e287fa7683f3d1e629ea57dd8fd1f4b8af8bbe8ce6ff49e6ca58e01f9e1ff307f5e86bef12e2c598ffbed176b3fd31ffb5ddba68f582f7d7773e26f317f3c76bf633a39fbd8459e6c3cc45b2fbbe023b65f82b0760fdecbeb20d8e3e06eb4fd447a84701635e86364cf139cb1c92bd77e89fd0697959fda13f431f62b2fe427f8641ed6d7e6f649ef4974bb6fa36767196f5a8afe063952cbfa8e71062992cdeeb99277d9bb936967d700c395f729139457b3f0f8c6391ec7ea799a7f5889f5e3659fdd295b18e6b5b8f791b674bbecedc6646fdc762c9a8cff1b9b5f3783b7367f124f4b33e977db6c7f9b18e4366e4479f0bc9fea13f63abebad5eb633673de1bd8d5d7499f1fe471d67395ec86f1c3420a647bca2c498f5785fd47a966cdea33fe318408b4769ac7ab3af3217793fcc2fdd2db3983f49d9eeeb3397d91ef35777cb2ce877a5291f94798a37fa59b539be8cbf5f54db65c67baada1c4f46fda936b3a4cc39be82f747b59919f35129c793f17e24af62f5bfba64d3ef67cef114f44b4201417fb064b3dfcb3cc51bf5a49459ce33a7ac47bda734f17c3109130b3bf61c3872e20f7ccc277cfab77ebef8d19e3ff2273ee373bee0cffc852ff98a177ccd5ff9e61fecbff12d7fe7a7bcca6bbcaeb2c61bbcc95bfc8c9f3fb4e717fc925fa9c5fa1d59e36ddee1d7bcfbc07ece6ff82deff1fe1d39e0777cc847fcfeae3dcfb8e0922bddbfbe270db7dc71cfc35d7b62221272e4ef49a048893e3cb03fa6133ad5151fefc9273aa373bab86b3f5fd067fa429774450b95eb2ce36fa7f4956ee81bdddeb3ff4e4f69552dd674cd29adab9cea6fd7b4419bb4c5f430fef48c9ed30b7a49af7e906ddaa1d7b44bf39fd8bfa1b7b447fb1ad5a5d001bda3433afa597e75c57b9a51a11129b378aaa8a6e6e7f5a0f62d75d4d3200cd1375e5f71fff7eef7ede70b09a26349b3a6221fe4584ee4f45fed3fca273993f351785d2ee4b37cf9a77a86fda55cc94273772cd7f2556ee49bdcfeabfd77792aabb226ebb2219bb225cf7ef4e627f6cfe585bc9457b22d3bf25a76e9e817f67379236f654ff6e540dec9e12fed8fe4bdccf46fb1522afd87a4f9953d56b4baa693f968fbc0feafff3cfa3f5814f320 ListBox1 contextMenuRequested(int,int) PopupMenu1 popup(int,int) ComboBox10 activated(int) ScriptObject35 execute(int) LineEdit1 LineEdit2 ExecButton28 ComboBox10 ListBox1