Author Topic: Build target window not resizing correctly.  (Read 18919 times)

Offline Souliest

  • Single posting newcomer
  • *
  • Posts: 3
Build target window not resizing correctly.
« on: June 11, 2014, 11:04:22 pm »
Hi,

I'm not sure if this is a bug, or a feature that doesn't behave like I expect it to, but here goes.

I'm using C::B to follow along a book, which generates many small programs. I found that using a build target per exercise makes it easy to manage. It's less "wasteful" than using a project each time, yet more structured than using standalones sources, without project.

Here is the issue. The first screenshot shows the Project->Properties->Build targets window of a new "Hello World" type project, with two targets. Everything is normal. The second screenshot shows the same window, split in two (because it won't fit in a single screen), with a project that has nearly one hundred targets, and roughly the same amount of files.

Here is the behavior that I would have expected: when you add targets, the "Build targets" list should add scrollbars as needed, at least a vertical scrollbar and increased width to accomodate the target names. The window as a whole should pretty much retain the same height.

What happens, however, is that that the build targets list increases in height so as to maintain about 20 empty lines at the end, and never gets scrollbars. The complete window (for all the tabs) increases in height, which adds a scrollbar to the window. This is both unsightly and inefficient. For example, look at the three button clusters to the right of the list ("Add / Rename / Duplicate / Delete", "Virtual targets / Dependencies / Re-order / Build options", and "Create project from target"). The clusters were obviously meant to be placed one at the top, one in the middle and one at the bottom of the list area.With a small list (screen 1), this is perfectly okay. With a large list (screens 2 and 3), the clusters have a huge gap between them. Also, when setting a few new targets I have to scroll up to duplicate a target or create a new one, scroll down to select it and maybe reorder it, scroll up to set the new executable, scroll down to check or uncheck the included files. The problem is that I scroll the whole window, when I should (that's what I think, anyway) only have to scroll within the targets and within the files.

I'm fairly new at this, so I apologize if my terminology is confusing. Please tell me if it is, so I can learn. And is this a bug? Should I report it?

Thanks.

Edit: CB 13.12 rev.9501, wxWidgets 2.8.12, OS Windows 7 64-bit


[attachment deleted by admin]

[attachment deleted by admin]
« Last Edit: June 30, 2014, 07:26:40 am by Souliest »

Offline Souliest

  • Single posting newcomer
  • *
  • Posts: 3
Re: Build target window not resizing correctly.
« Reply #1 on: June 29, 2014, 11:49:29 pm »
Okay, I hate to do this, but... bump.

Almost three weeks without any input. It is either because nobody understands what on Earth I'm talking about, nobody is able to replicate it, or nobody cares.

Which is it? If it's the first option, tell me so I can provide details or simplification, as needed. In the case of the second option, how does it impact what I should do, or is it a behavior I can change myself. And in the case of the third option, well... whatever.

Any response would be appreciated.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Build target window not resizing correctly.
« Reply #2 on: June 30, 2014, 12:39:42 am »
It works for me correctly; I suggest posting the normal info like CB version/svn, wxWidgets version, and OS name and version.

Edit: It worked correctly while adding the targets; once I closed the form and reentered it the effect was much like the complaint above.

Edit 2: Self built recent CB SVN trunk; wxWidgets 2.8.12; OS Windows 7 32-bit

Tim S.
« Last Edit: June 30, 2014, 02:35:59 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Souliest

  • Single posting newcomer
  • *
  • Posts: 3
Re: Build target window not resizing correctly.
« Reply #3 on: June 30, 2014, 07:32:00 am »
Thank you Tim. It is comforting to know than I am not crazy/alone. And I updated my post with the requested info. I hadn't even thought of including those.

I am using Windows 7 64-bit, with CB 13.12 (the Win binary from codeblocks.org), with wxWidgets 2.8.12.

S.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Build target window not resizing correctly.
« Reply #4 on: June 30, 2014, 04:31:37 pm »
If you self build Code::Blocks here is a patch to try.

The patch may NOT be safe to apply to CB SVN Truck
Because I edited the project_options.xrc file using text editor (I could not find the correct GUI method to edit it).
Because I am at beginner level at using wxWidgets GUI stuff like xrc and sizer.
Because the value of <size>120,360</size> was chosen almost at random; looks OK on Windows; no idea on other OSes.

Tim S.

Code
Index: src/src/resources/project_options.xrc
===================================================================
--- src/src/resources/project_options.xrc (revision 9841)
+++ src/src/resources/project_options.xrc (working copy)
@@ -255,8 +255,11 @@
  <object class="sizeritem">
  <object class="wxBoxSizer">
  <object class="sizeritem">
- <object class="wxListBox" name="lstBuildTarget" />
- <flag>wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
+ <object class="wxListBox" name="lstBuildTarget">
+ <size>120,360</size>
+ <style>wxLB_HSCROLL</style>
+ </object>
+ <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
  </object>
  <object class="sizeritem">
  <object class="wxBoxSizer">
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Build target window not resizing correctly.
« Reply #5 on: June 30, 2014, 05:24:22 pm »
Directions to manually fix Windows CB version 13.12.

1. Must make sure CB is NOT running
2. Rename share/CodeBlocks/resources.zip to something like resources.zip.orig
3. Download patched resources.zip https://github.com/stahta01/cb_misc/raw/master/CB_13_12/share/CodeBlocks/resources.zip
4. Copy downloaded resources.zip to share/CodeBlocks/

Note: share/CodeBlocks is normally under the folder C:\Program Files\CodeBlocks on windows.

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re:
« Reply #6 on: June 30, 2014, 06:42:37 pm »
Lol. You can edit xrc files with wxSmith. It looks like a good catch but the patch looks weird... Are you sure that is correct?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re:
« Reply #7 on: June 30, 2014, 07:27:13 pm »
Lol. You can edit xrc files with wxSmith. It looks like a good catch but the patch looks weird... Are you sure that is correct?

No, I am NOT sure it is correct; the changes are result of trial and error.
It does work better on windows; but, I think there must be a better fix than the one I found.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Build target window not resizing correctly.
« Reply #8 on: June 30, 2014, 10:09:33 pm »
Can someone show a screen shot of this same dialog but from the C::B project.
On linux I can see that there is a vertical scroll as expected.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Build target window not resizing correctly.
« Reply #9 on: July 01, 2014, 12:55:58 am »
Can someone show a screen shot of this same dialog but from the C::B project.
On linux I can see that there is a vertical scroll as expected.

On Windows 7 32 bit without any changes.
Link to image: http://github.com/stahta01/cb_misc/blob/master/Notes/Without_changes.png

On Windows 7 32 bit with my change.
Link to image: http://github.com/stahta01/cb_misc/blob/master/Notes/With_TimS_change.png

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Build target window not resizing correctly.
« Reply #10 on: July 01, 2014, 01:40:34 am »
Hm, you're using smaller font and all targets are visible. This is not the case for me.

Can someone share a test project?

BTW: Your fix is inappropriate.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Build target window not resizing correctly.
« Reply #11 on: July 01, 2014, 06:33:38 am »
Hm, you're using smaller font and all targets are visible. This is not the case for me.

Can someone share a test project?

BTW: Your fix is inappropriate.
I attach a sample project-file with 52 targets.
It has a scrollbar on linux, but it shows a similar issue:the list-control is much too  large.
I did not try to do any further tests.
I guess the problem is, that we do a dynamic layout after the list-control is populated.
If there are very long target names, it's the same, but in horizontal direction.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Build target window not resizing correctly.
« Reply #12 on: July 01, 2014, 10:04:33 am »
Reproduced. I've even modified it to include a long target name.

By dynamic layout you're probably talking about this snippet:
Code
    // make sure everything is laid out properly
    // before adding panels from plugins
    // we don't want the dialog to become huge ;)
    // note that a similar situation in editor settings had been solved by commenting
    // the following line out...
    GetSizer()->SetSizeHints(this);
I've commented it and it fixed only the first problem. It didn't fix the very-long-named-target problem.
I've taken a look here http://docs.wxwidgets.org/trunk/classwx_list_box.html and it seems there are problems with the ListBox control.
Have we tried to use a wxListCtrl instead?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Build target window not resizing correctly.
« Reply #13 on: July 02, 2014, 01:18:46 am »
I've just tried the wxListCtrl and it behaves pretty good.

Please test if the layout is correct with this test patch on windows: http://cmpt.benbmp.org/codeblocks/patches/project_options_layout_many_target.patch

NOTE: This patch is not meant for production use, it is meant to test the layout only. The dialog is totally broken, because I've not fixed all usages of the wxListBox!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Build target window not resizing correctly.
« Reply #14 on: July 02, 2014, 02:31:55 am »
I've just tried the wxListCtrl and it behaves pretty good.

Please test if the layout is correct with this test patch on windows: http://cmpt.benbmp.org/codeblocks/patches/project_options_layout_many_target.patch

NOTE: This patch is not meant for production use, it is meant to test the layout only. The dialog is totally broken, because I've not fixed all usages of the wxListBox!

Windows 7 32 bit build with your patch.
https://github.com/stahta01/cb_misc/blob/master/Notes/project_options_layout_many_target.png

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org