Author Topic: Part #2 - C programmers.. need assistance.  (Read 9451 times)

Offline console

  • Brobdingnagian Member
  • ***
  • Posts: 4518
  • "Man, this is the way to travel," said my attorney
    • View Profile
    • tastyspleen.net
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #15 on: April 09, 2007, 09:41:56 PM »
Hmm... Is it just that the new *button* doesn't show, or... do NONE of your changes show?  I.e. you had to move the close button to the right to make room for the Preview button.  Is there a "gap" now where the Preview button just doesn't show up?  Or does it look like none of your changes happened?

BTW, I notice you are in the "Solution Explorer" view instead of the "Resource view".  I don't know if that will make any difference, but, I always use the "Resource view" when editing resources.

In your Resource.h file, you should end up with a line like:

#define IDC_PREVIEW                     1234

Whatever number the 1234 is, it should be different than the other numbers for the other controls in that dialog.

Also, if you look in your "A Note.rc" file (you will prolly have to open it in Notepad... I don't think visual studio wants to open it directly.)  You should see the resource definitions for the dialog, like:

IDD_RECYCLEBIN DIALOGEX 0, 0, 171, 217
STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Recycle bin"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "Close",IDOK,114,7,50,14,BS_FLAT
    PUSHBUTTON      "Delete",IDC_DELETE,7,7,50,14,BS_FLAT
    PUSHBUTTON      "Restore",IDC_RESTORE,60,7,50,14,BS_FLAT
    LTEXT           "Title",IDC_STATIC1,7,26,17,8
    LISTBOX         IDC_TITLES,7,35,157,175,LBS_MULTIPLESEL |
                    LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL |
                    WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
END

Only, you should have an additional PUSHBUTTON for your IDC_PREVIEW.  If that's not there, something's wrong...


Regards,

quadz
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline [N]auTiCa

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Extreme Online Gaming
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #16 on: April 09, 2007, 09:53:04 PM »
Theres nothing showing up.. no gap or anything, it's as if I never added the button.

Here is where I defined it

Code: [Select]
#define ID_PRESSEDLEFTBUTTONONTRAYICON  2018
#define ID_TRAYSINGLECLICK                            2019
#define IDC_PREVIEW            2020
#define ID_MINIMIZEDMENUITEM                     10000

I then saved the file and opened a note.rc with notepad and didn't get anything.. all I get is this
Code: [Select]
IDD_RECYCLEBIN DIALOGEX 0, 0, 171, 217
STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION |
    WS_SYSMENU
CAPTION "Recycle bin"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "Close",IDOK,114,7,50,14,BS_FLAT
    PUSHBUTTON      "Delete",IDC_DELETE,7,7,50,14,BS_FLAT
    PUSHBUTTON      "Restore",IDC_RESTORE,60,7,50,14,BS_FLAT
    LTEXT           "Title",IDC_STATIC1,7,26,17,8
    LISTBOX         IDC_TITLES,7,35,157,175,LBS_MULTIPLESEL |
                    LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL |
                    WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
END

I don't understand why the hell this button is not showing up.

OK.. what I did was just copy the Delete button and paste it.. I think thats why the IDC tag is not picking up in a note.rc
How do you manually add a button to the dialog box?
« Last Edit: April 09, 2007, 09:57:23 PM by [N]auTiCa^K][L^ »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
Clan ^K][L^  co-leader! www.clankil.com
dC member! www.monsterkill.org

Offline console

  • Brobdingnagian Member
  • ***
  • Posts: 4518
  • "Man, this is the way to travel," said my attorney
    • View Profile
    • tastyspleen.net
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #17 on: April 09, 2007, 10:04:54 PM »
Hmm.. Well this time try going to the "Resource view" and add the button again.

In the screenshot below, you can see I've selected "Button" in the toolbox, and I'm dragging it onto the dialog.


Regards,

quadz
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline [N]auTiCa

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Extreme Online Gaming
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #18 on: April 09, 2007, 10:13:36 PM »
No luck.. I added the button from the toolbox, set the properties for the button similar to that of the other buttons and the damn thing still won't show up.

I'm curious.. did you try adding in the button and then running the program to see if it will at least show up, cuz I don't understand why mine isn't showing up.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
Clan ^K][L^  co-leader! www.clankil.com
dC member! www.monsterkill.org

Offline console

  • Brobdingnagian Member
  • ***
  • Posts: 4518
  • "Man, this is the way to travel," said my attorney
    • View Profile
    • tastyspleen.net
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #19 on: April 09, 2007, 10:20:00 PM »
Yeah, I just added it, it worked fine.  The resource definition ended up looking like this:

Code: [Select]
IDD_RECYCLEBIN DIALOGEX 0, 0, 223, 220
STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION |
    WS_SYSMENU
CAPTION "Recycle bin"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "Close",IDOK,166,7,50,14,BS_FLAT
    PUSHBUTTON      "Delete",IDC_DELETE,7,7,50,14,BS_FLAT
    PUSHBUTTON      "Restore",IDC_RESTORE,60,7,50,14,BS_FLAT
    LTEXT           "Title",IDC_STATIC1,7,26,17,8
    LISTBOX         IDC_TITLES,7,38,209,175,LBS_MULTIPLESEL |
                    LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL |
                    WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
    PUSHBUTTON      "Preview",IDC_PREVIEW,113,7,50,14
END


BTW... In your screenshot I notice you have a build error.  (OnPreview method not defined.)  You aren't going to be able to see your changes until you can successfully build the project.  :dohdohdoh:

I'm thinking of taking you up on that PayPal button....  :D :D :D :D :D :D :D

Regards,

quadz
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline [N]auTiCa

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Extreme Online Gaming
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #20 on: April 09, 2007, 10:25:33 PM »
ahhh.. now I see why it didn't show up. I went back into RecycleBin.cpp and removed where I added OnPreview, thats where my error was.

Now I'm back to square 1.. actually, I've now successfully added the Preview button. All thats left now is to somehow figure out building the preview class so that this damn message can get previewed.

I'm overlooking..

void CDlgRecycleBin::CreateImportXml(CString szFile)

hopefully I can make something of this code.

p.s. just let me know your acct and the funds will be transfered asap  8)

edit: looking at cdlgrecyclebin is like me trying to read chinese.. I don't understand a lick of it lol!

i need a donut break...
« Last Edit: April 09, 2007, 10:31:08 PM by [N]auTiCa^K][L^ »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
Clan ^K][L^  co-leader! www.clankil.com
dC member! www.monsterkill.org

Offline console

  • Brobdingnagian Member
  • ***
  • Posts: 4518
  • "Man, this is the way to travel," said my attorney
    • View Profile
    • tastyspleen.net
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #21 on: April 09, 2007, 10:44:34 PM »
Now I'm back to square 1.. actually, I've now successfully added the Preview button. All thats left now is to somehow figure out building the preview class so that this damn message can get previewed.

You learned a bit adding the button... but really, I'm not certain why you want a Preview button anyway. :)

Why not just have a preview pane next to the list box pane, and just show a preview of whatever note the user clicks on, automatically?  The button idea will work, too, but it's more work for the user (and slightly more work for you, too.)


p.s. just let me know your acct and the funds will be transfered asap  8)

Don't worry about it, but if you want to--use the PayPal button at the top of the forums. The money will go toward the quake servers...


edit: looking at cdlgrecyclebin is like me trying to read chinese.. I don't understand a lick of it lol!

HINT: It puts the notes in a linked list or else it gets the hose again.

Er... I mean:

Code: [Select]
class CRecycleBin 
{
public:
void SaveDeletedNote(void *pNote);
CRecycleBin();
virtual ~CRecycleBin();

protected:
void SaveDeletedNotes ();
void AddDeletedNote (void *Note);

// Struct that holds the key and it value in the XML file
struct tagCString {
CString szName;
CString szValue;
};
void ParseXML ();
void GetXMLChildren (MSXML2::IXMLDOMNodePtr pParent);
void GetXMLChild (MSXML2::IXMLDOMNodePtr pChild);

private:
MSXML2::IXMLDOMDocumentPtr m_plDomDocument;
MSXML2::IXMLDOMElementPtr m_pDocRoot;
CList <tagCString, tagCString&> m_sString; // The strings in the XML file
CList <tagNote, tagNote&> m_pNote; // The notes in the file deleted notes.xml

};

The RecycleBin class keeps its notes in a linked list (CList) called m_pNote.

Correspondingly, the CDlgRecycleBin dialog class keeps the titles of the notes in a list box (CListBox).

You can ask a CListBox for the indexes of which items are selected.  For ex, in CDlgRecycleBin::CreateImportXml:

  m_pTitle.GetSelItems (BUFFERSIZE, rgIndex);

When you ask the CListBox for the index numbers for the items selected by the user, it is then possible to walk the linked list (m_pNote) to find the corresponding note data.  I.e. if item number "2" is selected in the CListBox, then the "3rd" node in the linked list is the note you're interested in.  (3rd, because the indexes are zero-based... 0,1,2 = 3rd.)


Regards,

quadz

  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline [N]auTiCa

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Extreme Online Gaming
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #22 on: April 09, 2007, 11:03:49 PM »
OK.. I'm beginning to understand CDlgRecycleBin a little better now thanks to your interpretation.

However, how am I to add a preview pane to display the message.. now I'm confused if I should go the button route or just do what you said, seeing as you believe it's easier to manipulate. Now I just don't know where I would start to insert a preview pane. I was just going by what the assignment asked to do. It said to add another frame to display the content of the note that is to be restored. Now I'm completely lost! lol.. and it's past 2am and I still have to finish my calc 2 homework (which thankfully I don't need any help with lol)
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
Clan ^K][L^  co-leader! www.clankil.com
dC member! www.monsterkill.org

Offline console

  • Brobdingnagian Member
  • ***
  • Posts: 4518
  • "Man, this is the way to travel," said my attorney
    • View Profile
    • tastyspleen.net
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #23 on: April 09, 2007, 11:27:20 PM »
However, how am I to add a preview pane to display the message.. now I'm confused if I should go the button route or just do what you said, seeing as you believe it's easier to manipulate. Now I just don't know where I would start to insert a preview pane. I was just going by what the assignment asked to do. It said to add another frame to display the content of the note that is to be restored.

Well, that's what I'm saying... as far as I can tell you need to add the preview pane anyway, because that's what your assignment asked for.

Why not add it to the right of the list box showing the titles of the notes in the recycle bin?

Something like: (screenshot)

Regards,

quadz
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline [N]auTiCa

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Extreme Online Gaming
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #24 on: April 09, 2007, 11:40:01 PM »
awesome.. I'm adding it right now.. after that I think I'm going to call it a a night, have to be at work in 6 hours, then class all afternoon. I'll be back tomorrow night. I have to complete this tomorrow night so hopefully everything works out. Thanks for your help today quadz.. I'll be back tomorrow night surely asking for more help :)

- [N]auTiCa
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
Clan ^K][L^  co-leader! www.clankil.com
dC member! www.monsterkill.org

Offline [N]auTiCa

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Extreme Online Gaming
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #25 on: April 10, 2007, 08:38:53 PM »
HINT: It puts the notes in a linked list or else it gets the hose again.

Er... I mean:

Code: [Select]
class CRecycleBin 
{
public:
void SaveDeletedNote(void *pNote);
CRecycleBin();
virtual ~CRecycleBin();

protected:
void SaveDeletedNotes ();
void AddDeletedNote (void *Note);

// Struct that holds the key and it value in the XML file
struct tagCString {
CString szName;
CString szValue;
};
void ParseXML ();
void GetXMLChildren (MSXML2::IXMLDOMNodePtr pParent);
void GetXMLChild (MSXML2::IXMLDOMNodePtr pChild);

private:
MSXML2::IXMLDOMDocumentPtr m_plDomDocument;
MSXML2::IXMLDOMElementPtr m_pDocRoot;
CList <tagCString, tagCString&> m_sString; // The strings in the XML file
CList <tagNote, tagNote&> m_pNote; // The notes in the file deleted notes.xml

};

The RecycleBin class keeps its notes in a linked list (CList) called m_pNote.

Correspondingly, the CDlgRecycleBin dialog class keeps the titles of the notes in a list box (CListBox).

You can ask a CListBox for the indexes of which items are selected.  For ex, in CDlgRecycleBin::CreateImportXml:

  m_pTitle.GetSelItems (BUFFERSIZE, rgIndex);

When you ask the CListBox for the index numbers for the items selected by the user, it is then possible to walk the linked list (m_pNote) to find the corresponding note data.  I.e. if item number "2" is selected in the CListBox, then the "3rd" node in the linked list is the note you're interested in.  (3rd, because the indexes are zero-based... 0,1,2 = 3rd.)



Alright.. I'm lost working with link lists.. I've been trying to grab the text to display it in the preview box, but nothing is happening when I click. I don't think I am inserting the code in the correct place. Do I have to create a whole new class to handle this operation, or can I just add this command somewhere for it to perform this? ...I'm getting worried now cuz I have to get this completed tonight.  :help:

I'll fiddle some more and post some code in a bit.. but what good would it do.. it's not working.

p.s. I hope your on tonight.. your my only hope  :)
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
Clan ^K][L^  co-leader! www.clankil.com
dC member! www.monsterkill.org

Offline console

  • Brobdingnagian Member
  • ***
  • Posts: 4518
  • "Man, this is the way to travel," said my attorney
    • View Profile
    • tastyspleen.net
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #26 on: April 10, 2007, 09:21:25 PM »
Alright.. I'm lost working with link lists.. I've been trying to grab the text to display it in the preview box, but nothing is happening when I click. I don't think I am inserting the code in the correct place. Do I have to create a whole new class to handle this operation, or can I just add this command somewhere for it to perform this?

A linked list is a way of connecting data structures together in a linear fashion. 

    (A) <----> (B) <----> (C) <----> (D)

Linked lists have beneficial properties such as being able to remove/insert nodes in O(1) time.  However, on the downside, linked lists are not a Random Access container.  They are O(n) complexity for locating a given node.

So if you know you want the 3rd element in a linked list, you either have go:

    (A) ----> (B) ----> (C)

Or, if it's a doubly linked list and you wanted the 3rd from the END of the list you could go:

    (D) ----> (C) ----> (B)


Anyway, the notes in the Recycle Bin are stored in memory in a linked list.

But as far as the User Interface is concerned, the titles of the notes are shown to the user by way of a CListBox.  And the user can select various note(s) in the list box.  You can then ask the CListBox for what indicies the user has selected.

You can then take those index numbers, and use them to find nodes in the linked list containing the note data structures.


Regards,

quadz


« Last Edit: April 10, 2007, 09:28:48 PM by console »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline [N]auTiCa

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Extreme Online Gaming
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #27 on: April 10, 2007, 09:39:47 PM »
OK.. beginning to understand how this works some more now.. is there a way to just call the m_pNote so that it's contents are displayed in the preview window?

Code: [Select]
private:
MSXML2::IXMLDOMDocumentPtr m_plDomDocument;
MSXML2::IXMLDOMElementPtr m_pDocRoot;
CList <tagCString, tagCString&> m_sString; // The strings in the XML file
CList <tagNote, tagNote&> m_pNote; // The notes in the file deleted notes.xml

};

it says 'The notes in the file deleted notes.xml'

Now I'm trying to figure out if I can just have m_pNote show what I want, but I'm clueless on how to set it up so that it will show.

(sorry for coming off on not knowing much.. like I said before, I haven't done C programming in yrs).
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
Clan ^K][L^  co-leader! www.clankil.com
dC member! www.monsterkill.org

Offline [N]auTiCa

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Extreme Online Gaming
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #28 on: April 10, 2007, 10:15:56 PM »
I've been looking at the msdn library concerning listboxes and saw this

C++

private:
   void listBox1_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Get the currently selected item in the ListBox.
      String^ curItem = listBox1->SelectedItem->ToString();

      // Find the string in ListBox2.
      int index = listBox2->FindString( curItem );

      // If the item was not found in ListBox 2 display a message box,
      //  otherwise select it in ListBox2.
      if ( index == -1 )
            MessageBox::Show( "Item is not available in ListBox2" );
      else
            listBox2->SetSelected( index, true );
   }


was wondering if any of that information would be relevant to what I'm trying to do?

Although, all I see in that code is that it displays a message box.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
Clan ^K][L^  co-leader! www.clankil.com
dC member! www.monsterkill.org

Offline console

  • Brobdingnagian Member
  • ***
  • Posts: 4518
  • "Man, this is the way to travel," said my attorney
    • View Profile
    • tastyspleen.net
  • Rated:
Re: Part #2 - C programmers.. need assistance.
« Reply #29 on: April 10, 2007, 10:32:08 PM »
Really, almost everything you need is in this one method:

Code: [Select]
void CDlgRecycleBin::CreateImportXml(CString szFile)
{
// Create the import file where the restored note will be in

POSITION pos;
CString szXML, szTemp;
CRect rc1, rc2;

if (theApp.m_bSortRecycleBinDescending)
pos = m_pNote.GetTailPosition ();
else
pos = m_pNote.GetHeadPosition ();

POSITION delpos;
int rgIndex[BUFFERSIZE];
m_pTitle.GetSelItems (BUFFERSIZE, rgIndex);
int iRow = 0;
int iCount = 0;

CXml xml;
xml.StartCreateRecycleBinXml ();

while (pos) {
delpos = pos;
tagNote note;

if (theApp.m_bSortRecycleBinDescending)
note = m_pNote.GetPrev (pos);
else
note = m_pNote.GetNext (pos);

if (iRow == rgIndex[iCount]) {

xml.CreateRecycleBinXml (note);


// Erase this note from the list
m_pNote.RemoveAt (delpos);
}

iRow++;
}

xml.EndCreateRecycleBinXml ();
szXML = xml.GetCreateRecycleBinXml ();

// Save the note now
CStdioFile fp;
if (!fp.Open (szFile, CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate)) {
CErrorLog::CErrorLog (INFO, _T("Could not open the import notes.xml"));
return;
}

TRY
{
#if (defined (UNICODE) || defined (_UNICODE))
int iLength, iMultibyte;
CString szResult;

iLength = szXML.GetLength ();
WCHAR *pwcUnicode = new WCHAR [sizeof (WCHAR) * (iLength + 1)];
char *pcDest = new char [2 * (iLength + 1)];

// To UTF-8
iMultibyte = WideCharToMultiByte (CP_UTF8, 0, szXML, iLength , pcDest, 2*iLength, NULL, NULL);
fp.Write (pcDest, iLength);
delete []pwcUnicode;
delete []pcDest;
#else
fp.Write (szXML, szXML.GetLength ());
#endif
fp.Close ();
}
CATCH (CFileException, e)
{
CErrorLog::CErrorLog (ERR, _T("Could not write file import notes.xml"));
return;
}
END_CATCH
}


... because it contains the code to do the mapping from the user interface CListBox items (m_pTitle), to the linked list (m_pNote) items.

The code above is already doing what you want.  You'll just need to identify the meaningful parts and extract them to a new routine, to find the (first?) selected item and find the note data and display it.


Regards,

quadz
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

 

El Box de Shoutamente

Last 10 Shouts:

Costigan_Q2

November 11, 2024, 06:41:06 AM
"Stay cozy folks.

Everything is gonna be fine."

There'll be no excuses for having TDS after January 20th, there'll be no excuses AT ALL!!!
 

|iR|Focalor

November 06, 2024, 03:28:50 AM
 

RailWolf

November 05, 2024, 03:13:44 PM
Nice :)

Tom Servo

November 04, 2024, 05:05:24 PM
The Joe Rogan Experience episode 223 that dropped a couple hours ago with Musk, they're talking about Quake lol.

Costigan_Q2

November 04, 2024, 03:37:55 PM
Stay cozy folks.

Everything is gonna be fine.
 

|iR|Focalor

October 31, 2024, 08:56:37 PM

Costigan_Q2

October 17, 2024, 06:31:53 PM
Not activated your account yet?

Activate it now! join in the fun!

Tom Servo

October 11, 2024, 03:35:36 PM
HAHAHAHAHAHA
 

|iR|Focalor

October 10, 2024, 12:19:41 PM
I don't worship the devil. Jesus is Lord, friend. He died for your sins. He will forgive you if you just ask.
 

rikwad

October 09, 2024, 07:57:21 PM
Sorry, I couldn't resist my inner asshole.

Show 50 latest
Welcome, Guest. Please login or register.
November 24, 2024, 08:30:47 PM

Login with username, password and session length