Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Hide listview until item selected n radiogroup

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Tue Oct 04, 2016 12:35 pm    Post subject: Hide listview until item selected n radiogroup Reply with quote

I have some borrowed code part of which creates a radiogroup and listview. The code works, but what I'm attempting to do is to hide the listview until one of the items is selected in the radiogroup.
Code:
trainer =    {
            Data =    {
                        Characters =    {
                                          [0] = "Hero";
                                          [1] = "Quistis";
                                          [2] = "Zell";
                                          [3] = "Irvine";
                                          [4] = "Rinoa";
                                          [5] = "Selphie";
                                          [6] = "Seifer";
                                          [7] = "Edea";
                                          [8] = "No One";
--
                                          ["Hero"] = 0;
                                          ["Quistis"] = 1;
                                          ["Zell"] = 2;
                                          ["Irvine"] = 3;
                                          ["Rinoa"] = 4;
                                          ["Selphie"] = 5;
                                          ["Seifer"] = 6;
                                          ["Edea"] = 7;
                                          ["No One"] = 8;
                                       };
                        Stats =   { -- Exp and level
                                    {{1,9999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                    {{1,9999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                    {{1,9999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                    {{1,9999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                    {{1,9999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                    {{1,9999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                    {{1,9999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                    {{1,9999};{2,1999};{3,2999};{4,3999};{5,4999};{6,5999};{7,6999};{8,7999};{9,8999};{10,9999};{11,10999};{12,11999};{13,12999};{14,13999};{15,14999};{16,15999};{17,16999};{18,17999};{19,18999};{20,19999};{21,20999};{22,21999};{23,22999};{24,23999};{25,24999};{26,25999};{27,26999};{28,27999};{29,28999};{30,29999};{31,30999};{32,31999};{33,32999};{34,33999};{35,34999};{36,35999};{37,36999};{38,37999};{39,38999};{40,39999};{41,40999};{42,41999};{43,42999};{44,43999};{45,44999};{46,45999};{47,46999};{48,47999};{49,48999};{50,49999};{51,50999};{52,51999};{53,52999};{54,53999};{55,54999};{56,55999};{57,56999};{58,57999};{59,58999};{60,59999};{61,60999};{62,61999};{63,62999};{64,63999};{65,64999};{66,65999};{67,66999};{68,67999};{69,68999};{70,69999};{71,70999};{72,71999};{73,72999};{74,73999};{75,74999};{76,75999};{77,76999};{78,77999};{79,78777};{80,79777};{81,80999};{82,81999};{83,82999};{84,83999};{85,84999};{86,85999};{87,86999};{88,87999};{89,88999};{90,89999};{91,90999};{92,91999};{93,92999};{94,93999};{95,94999};{96,95999};{97,96999};{98,97999};{99,98999};{100,99999};};
                                    {};
                                  };
                     };
            };
           
function trainer:start()
   self.form = createForm(false);
   setProperty(self.form , "BiDiMode", "bdLeftToRight");
   self.form.Caption = 'Cheat Panel';
   self.form.Width = 350;
   self.form.Height = 360;
   self.form.Left = 445;
   self.form.Top =7;
--
   self.listview = createListView(self.form)
   setProperty(self.listview, 'ViewStyle', 'vsReport')
   setProperty(self.listview, 'RowSelect', 'True')
   setProperty(self.listview, 'ReadOnly', 'True')
   setProperty(self.listview, 'HideSelection', 'False')
   self.listview.top = 95;
   self.listview.width = 130;
   self.listview.left = 95;
   self.listview.height = 250;

-- self.listview.visible = false The code to hide worked, but when a radiogroup item was selected, the listview remained invisible
Code:

   self.listview.onClick = function (sender)
                              local char
                              if (self.characters_rg.ItemIndex >= 0 ) then
                                 char = strings_getString(self.characters_rg.getItems(), self.characters_rg.ItemIndex);
This is where I attempted to make the listview visible, but doesn't work
-- self.listview.visible = true
end
Code:

                              local row_1 = sender.getItems().getItem(sender.getItemIndex()); -- Level
                              local row_2 = strings_getString(row_1.getSubItems(),0) + 0; -- Exp
                              if (char and row_1 and row_2) then
                                 local address_1 = addresslist_getMemoryRecordByDescription(getAddressList(), char .. ' EXP Earned (Affects Level)');
                              end
                              self.characters_rg.setItemIndex(8);
                           end
   self.listview_colum1 = self.listview.getColumns().add()
   self.listview_colum1.Width = 40;
   self.listview_colum1.Caption = 'Lvl';
   self.listview_colum2 = self.listview.getColumns().add()
   self.listview_colum2.Width = 90;
   self.listview_colum2.Caption = 'Exp';
--
   self.characters_rg = createRadioGroup(self.form);
   self.characters_rg.height = 250;
   self.characters_rg.width = 90;
   self.characters_rg.top = 90;
   self.characters_rg.left = 5;
   for character,_ in pairs(self.Data.Characters) do
      if tonumber(character) then
         self.characters_rg.getItems().add(_);
      end
   end
   self.characters_rg.onClick =    function (sender)
                                    local index = strings_getString(sender.getItems(), sender.ItemIndex); -- I'm bit lazy, so sender == trainer.characters_rg
                                    local i = nil;
                                    i = self.Data.Characters[index] + 1; -- If the character does not hold the value,, i remains nil.
                                    if i then
                                       heroname = index;
                                       self.listview.visible = true
                                       print("The hero name is ", heroname);
                                       self.listview.clear();
                                       for _,__table in pairs(self.Data.Stats[i]) do
                                          local entry = self.listview.getItems().add();
                                          entry.Caption = __table[1];
                                          local subentry = entry.getSubItems().add(__table[2]);
                                       end
                                    end
                                    if expvalue and goldvalue and heroname then
                                       RecalculateAddresses()
                                    end
                                 end


Without both of the commented out lines, the code runs fine, i.e. populated the radiogroup and listview and changes the experience in the table, but I would like to hide the listview until an item is selected and then hide it again after this line of code self.characters_rg.setItemIndex(Cool;

Any suggestions?
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Tue Oct 04, 2016 12:47 pm    Post subject: Reply with quote

try OnClick instead of onClick (though that shouldn't matter)

besides that I can't quickly see. The text "The hero name is" is being shown ?

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Sun Oct 09, 2016 9:15 am    Post subject: Reply with quote

Dark Byte wrote:
try OnClick instead of onClick (though that shouldn't matter)

besides that I can't quickly see. The text "The hero name is" is being shown ?


I didn't get an email that there was a response, so sorry for the delay in answering.
Do you mean this command?
Code:
   self.listview.onClick = function (sender)

As to your next question, the attempt was for a heroname to be selected when/if a radiogroup button was pushed and should be set to the index
Code:
heroname = index;
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites