User forums > Using Code::Blocks

debuging the code: how add variables and arrays objects to watches window?

<< < (5/5)

oBFusCATed:
Then it is a GDB or MinGW progblem (don't know if outputdebugstring is a OS or runtime thing).

cambalinho:
that's why i did my own:

--- Code: ---void debugtext(string text)
{
    //create a permanent controls
    static form debugwindow("Debug Window");
    static label lblDebugText("",debugwindow);

    //control the static depending on it's parent size
    debugwindow.Resize=[]()
    {
        lblDebugText.setWidth(debugwindow.width-10);
        lblDebugText.setHeight(debugwindow.height-10);
    };

    //resize the parent window
    debugwindow.width=1000;
    debugwindow.height=400;

    //print the text depnding if have some text or not
    if(lblDebugText.getText()=="")
        lblDebugText.setText(text);
    else
        lblDebugText.setText(lblDebugText.getText() + "\n" + text);
}
--- End code ---
using it:

--- Code: ---bool blnRightMouseButtonDown=false;
button btnarray[8];

int WinMain()
{
    OutputDebugString("hello world");
    int arraysize=ArraySize(btnarray, button);//geting the array size
    int i=0;
    for (i; i<arraysize; i++)
    {
        int inttop=150 + (i*50);

        btnarray[i].setTop(inttop);
        btnarray[i].setLeft(0);
        btnarray[i].setText(to_string(i));
        btnarray[i].MouseClick=[i]()
        {
            MessageBox(btnarray[i].getText());
        };
        debugtext((string)to_string(inttop) + "\t" + to_string(i));
    }
--- End code ---

https://onedrive.live.com/?id=C3EF456E15C8DEB6!1295&cid=C3EF456E15C8DEB6&group=0&parId=C3EF456E15C8DEB6!197&o=OneUp

it's from my public hotmail folder

Navigation

[0] Message Index

[*] Previous page

Go to full version