Excellence IRC Logs 20113 - OOP344
Sandip> hi <cap6> I'm responding, but it doesnt seem to be going through <cap6> _flags is an unsigned int so there's 32 bits <cap6> if selected = true set the _cnt bit in _flags to 1 <Sandip> and what he meant by update pattern ? <cap6> say for instance the bits in _flags is 000000000001110000001111 <cap6> every 1 in that pattern matches up with a checked checkmark <Sandip> ok <Sandip> then <cap6> the full line would be <cap6> if (selected==true) _flags = _flags <cap6> dammnit <cap6> if (selected==true) _flags = _flags | 1 << _cnt; <cap6> that will update the bit pattern <Sandip> _cnt is the bit we ARE looking at you mean ? <cap6> _cnt is how many checkmarks we've already added so by leftshifting _cnt times you set the correct bit <Sandip> Can you be able to correct my code ? As this function is the main function
- [cap6] (~cap6@bas1-aurora91-3096739336.dsl.bell.ca): ...
- [cap6] #seneca-oop344
- [cap6] holmes.freenode.net :London, UK
- [cap6] idle 00:01:30, signon: Tue Dec 06 18:21:23
- [cap6] is logged in as cap6
- [cap6] End of WHOIS list.
<Sandip> I am quite understanding what your saying now <Sandip> we got 32 checkbox <Sandip> and when we click on any of them we have to update bit pattern according to <cap6> yup you have to change the bit that corresponds to the clicked checkmark <Sandip> shoudn't it be like this if (selected==true) _flags = _flags | 1 << (_cnt - 1); <cap6> it all depends on when you increase _cnt <cap6> if you dont increase _cnt till the very end of the function then you dont need the -1 <Sandip> so can you go into my branch and pick checklist folder and edit that function for me and commit <cap6> alright <Sandip> so that credit will goes to your account <Sandip> as you helped me doing this function <Sandip> still when i run my code I am getting wired errors ? <cap6> the only problem that I'm getting is with draw <cap6> and that's only because it hasnt been written yet <cap6> I committed a working add to your branch <Sandip> well we just need to call draw function from chekmarks thats it <Sandip> I already done that <cap6> no <cap6> by saying draw(fn); <Sandip> ya <Sandip> I did that <cap6> you've created infinite recursion <Sandip> didnt you see that <Sandip> I am done with all of other functions <Sandip> ohh <Sandip> I seee thats why i am getting weird erros <cap6> you're calling CChecklist::draw(fn) within CChecklist::draw(fn) <Sandip> should I have to create my own draw function <cap6> o yeah <cap6> you have to draw each checkmark <cap6> and call CFrame::draw(); <Sandip> the way you did in checkmark class right ? <cap6> for each _checkmarks you just call their draw() <cap6> _checkmarks[i]->draw(); <Sandip> so I go through all check mark using _cur variable and then call that function <Sandip> right ? <cap6> you can just use i <cap6> and make a for loop <Sandip> ok I do that and let you know <cap6> k <Sandip> ya it draws the checkmarks but at the end gives some violation error <Sandip> Unhandled exception ? <cap6> you probably tried to draw a checkmark that wasnt there <cap6> like you went past _cnt <Sandip> ok <Sandip> ya your right ? <Sandip> fixed that <Sandip> I got a great help from you <cap6> np <Sandip> be right here. I will come after fixing some of the things and will let you know for some other help I need. One more thing we should update our team page with our chat log <cap6> I dont think we can link the chat if it's private like this <Sandip> why so <Sandip> I can take either screen shot or copy all our chat <cap6> that's true I guess <cap6> didnt think about that <Sandip> well tell me draw function accept parameter fn <Sandip> what is that <Sandip> do we have to use fn or _cnt ? <Sandip> to draw checklist <cap6> you can just leave it blank <cap6> it doesnt affect the checklist <Sandip> I used _cnt for now <cap6> cdialog.draw is that only one that actually uses the fn parameter <Sandip> I dont know I think I have some bugs in my edit function when I try to select another checkmarks loop goes infinite <cap6> could be a bunch of different things <Sandip> what could be the reason ? <cap6> Where's the infinite loop actually happening? <Sandip> Inside edit function <Sandip> take a look to my code <Sandip> I have written key = edit(); <Sandip> might be that causes to happen infinite looping <Sandip> as I am already inside the edit function <cap6> yeah you cant do that <cap6> key = _checkmarks[_cur].edit() <Sandip> I tried that <Sandip> but that gives me an error <Sandip> I used console.getKey(); <cap6> that's different <cap6> you have to call the checkmark edit <Sandip> but why ? as your already inside your edit function <Sandip> you just need to grab a key <cap6> you're in the checklist edit not the checkmark's edit <Sandip> key = _checkmarks[_cur]->edit() <Sandip> this line causes an error to occur <cap6> what's the error? <Sandip> access violation when I hit enter <Sandip> when i hit enter/left/right any key <Sandip> i got access violation error <cap6> I'm not sure what's causing it <cap6> o <cap6> _checkmarks[i] became null somehow <Sandip> ok tell me when I go through all check marks how do I make them checked or unchecked <Sandip> using _flags ? <cap6> _checkmarks[i]->checked(true or false) <cap6> then you have to update the _flag <Sandip> _flags = _checkmarks[i]->checked() ? 1: 0; <Sandip> right <cap6> no <cap6> you have to use bitwise operators <Sandip> _flags = 1 << _cur; <cap6> _flags = _flags ^ 1<<_cur; <cap6> that will flip the bit no matter what it was <Sandip> then it would also affect the others <cap6> nope <cap6> it exclusive ORs it <Sandip> ok now i would be able to go to the first check mark <cap6> o the first checked checkmark? <Sandip> the problem that I am getting now is when I hit space it does select the check mark but when I hit up or down key it doesnt go to the next one <Sandip> ya <cap6> can you commit it <Sandip> ok <Sandip> now I have committed all of my changes <cap6> k <Sandip> you can take a look at it <cap6> one thing you need to take out is your default part of the case <cap6> you dont want to exit as a default <Sandip> ok <cap6> and you dont move through the list because you never increase or decrease cur in your down/up cases <Sandip> I do I mean I set down = 1 or 0 so that when it comes inside the switch by default it goes into case 0 <Sandip> where I increase or decrease them <cap6> it doesnt work like that <Sandip> let me try what your saying <cap6> you have to increase and decrease in the up/down cases <Sandip> ya your right <cap6> I think you can take that "0" case out <Sandip> ok I did it now when I press right or down continue then it gives me violation error <Sandip> I think this is because _cur exceeds it limit right ? <cap6> yeah <cap6> o <Sandip> how do I check to see that _cur is the last one ? <cap6> you have to use _cnt not 32 <Sandip> If i use _cnt only then it would stop at 3rd position only <cap6> _cnt should be 7 <Sandip> well we cant hard code it <Sandip> dont you think so ? <cap6> you cant hard code it <cap6> _cnt should be 7 and it shouldnt be stopping at the 3rd one <Sandip> I have committed my code take a look at it and once you solved commit it back <Sandip> I think I am very close to finish everything up <cap6> you have no condition for the down/right one <cap6> it just says _cur <Sandip> (_cur) ? (done = true) ? _cur++; <cap6> (_cur >= _cnt-1)? (done = true) : _cur++; <Sandip> this is the condition I set it <cap6> that's what it should be <Sandip> awesome <cap6> your space case isnt correct <Sandip> did you committed your changes <cap6> no <Sandip> or should I commit <cap6> you can just do it <Sandip> ok <Sandip> now it says that it is a radio list but still I can be able to select all of them ? <Sandip> even if i had a condition inside of my edit function <Sandip> when you hit space it checks that is it a radio list or simple check list by calling a radio() function <cap6> your conditions arent correct <Sandip> then according to your suggestion i am selecting the current one and setting others to 0 <Sandip> why is so ? <Sandip> radio() checks that it is a radio list or not <Sandip> am I correct ? <cap6> it does <cap6> you can also just use _radio <Sandip> then <Sandip> ? <cap6> in your for loop you have to decheck all the checkmarks <cap6> then set _flags to 0 <Sandip> _flags = _flags ^ 1<<_cur <cap6> that works for when it's not radio <Sandip> ok <Sandip> i check it with another condition <cap6> you also have to change the checked value of the checkmark object <Sandip> what is that mean ? <Sandip> checkmark object ? <cap6> _checkmarks[i]->checked(false) <cap6> I added a txt file to your branch that has what I think the space case should be <cap6> I'll be back in a couple mins <Sandip> you there <Sandip> hey <Sandip> you there <Sandip> void* data(); <Sandip> returns the bit pattern held in _flags. <Sandip> make sure _flags are updated to the status of the _checkmarks <Sandip> This is the final question