Hi,I have a few questions.Hope its not a problem to write all of them mixed in one topic.
1)for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
{dc.DrawPoint(j,i); wxSleep(1);}
Is this wrong?If yes why? (here newbie thinks that he can see the points being drawn one-by-one)
2)I draw on a panel,and if I set the stretch parameter for that panel in the boxsizer,when I resize the main window(increase the size),the drawing changes (stretches).In other words,Is it normal the drawing(e.g rectangles) I made using absolute coordinates changes shape at last row&column when the drawing panel changes size?(please see the attachments)
3)I have a boxsizer based layout.And there is a panel at the middle of it.According to user selections,I change the size of the panel to have room for larger content.How can I change the size of the panel,and let the whole window to resize itself according to new dimensions?(thisis the same panel in question2,on which I draw using wxPaintDC)I tried but coulnt re-set the layout and wxALIGN_CENTER didnt work in this new case.
Thanks in advance
a few newbie questions
Re: a few newbie questions
Not technically wrong, but still badIs this wrong?If yes why? (here newbie thinks that he can see the points being drawn one-by-one)Code: Select all
for(int i=0;i<n;i++) for(int j=0;j<n;j++) { dc.DrawPoint(j,i); wxSleep(1); }
Whether you see the single dots appearing depends on the platform and on the type of wxDC you're painting on. With a normal wxPaintDC or wxClientDC on a platform that doesn't automatically use double buffering you should see the dots one-by-one.
This is still bad though, because you're blocking the gui and depending on what the user does, several new paint events may get triggered and you end up with a totally unresponsive application.
What attachment?2)I draw on a panel,and if I set the stretch parameter for that panel in the boxsizer,when I resize the main window(increase the size),the drawing changes (stretches).In other words,Is it normal the drawing(e.g rectangles) I made using absolute coordinates changes shape at last row&column when the drawing panel changes size?(please see the attachments)
The graphic should not stretch, without further information i'd say there must be an error in your drawing code.
Usually when you put a control into a sizer, you gave up control over its size. You can use wxWindow::SetMinSize() / SetMaxSize() to set contraints though. Afterwards call Layout() on the topmost sizer.3)I have a boxsizer based layout.And there is a panel at the middle of it.According to user selections,I change the size of the panel to have room for larger content.How can I change the size of the panel,and let the whole window to resize itself according to new dimensions?
Use the source, Luke!