Author Topic: ScrollingDialog  (Read 15928 times)

Rossifumi

  • Guest
ScrollingDialog
« on: February 08, 2011, 04:36:39 pm »
Hi, i'm new in this forum...i'm an italian student so previously sorry for my english.
I've a problem with CodeBlocks + wxSmith:

i need to use a scrollingdialog, so i've used the command in wxsmith to add a scrollingdialog to my project, and i draw all my widgets. But when i build my project i receive an error in -->#include "scrollingdialog.h".

How can i resolve it?
i've read some topics in this forum, but i don't find any answers.

i'm working on windows 7 64 bit.

thanks.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: ScrollingDialog
« Reply #1 on: February 08, 2011, 05:15:37 pm »
You need scrollingdialog.h and scrollingdialog.cpp from our sdk to make it work.
You can either download C::B's sources and extract them or download them from my server:
http://apt.jenslody.de/downloads/scrollingdialog.cpp
http://apt.jenslody.de/downloads/scrollingdialog.h

Just copy both in your projects folder and add them to your project.

Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #2 on: February 08, 2011, 05:25:25 pm »
Thank you so much....
All rights. Now i've my scrollingdialog!!!! :lol: :lol:

Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #3 on: February 09, 2011, 11:57:47 am »
Another thing...is it possible to set the size of the scrollingdialog window??
because it has a full height...thanks.
« Last Edit: February 09, 2011, 12:17:27 pm by Rossifumi »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: ScrollingDialog
« Reply #4 on: February 09, 2011, 02:59:10 pm »
It should work as for "real" wxDialogs.
We use it for almost all dialogs in C::B and it works correctly there (as far as I know).

Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #5 on: February 09, 2011, 03:39:20 pm »
yeah...but when i use SetMaxSize(-1,700);
i receive this error in runtime....

i suppose there is a conflict with the

FlexGridSizer->Fit(this);
FlexGridSizer->SetSizeHints(this);

???
« Last Edit: February 09, 2011, 03:41:56 pm by Rossifumi »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: ScrollingDialog
« Reply #6 on: February 09, 2011, 05:26:00 pm »
It should work as for "real" wxDialogs.
We use it for almost all dialogs in C::B and it works correctly there (as far as I know).

Is this going to be redundant soon? http://docs.wxwidgets.org/trunk/overview_dialog.html#overview_dialog_autoscrolling

Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #7 on: February 09, 2011, 05:51:14 pm »
thanks for reply...but i don't resolve my problem..
i explain better my situation:
i have a scrollingdialog that is ok...it scrolls...but it initial size is fit in weight, and is fullscreen in height...so, my question is:
"can i resize the scrollingdialog's heigth, so that its initial height is i.e. 700px?"

because it scrolls it isn't important that its height is max in the screen....

thanks for help.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: ScrollingDialog
« Reply #8 on: February 09, 2011, 06:07:08 pm »
yeah...but when i use SetMaxSize(-1,700);
i receive this error in runtime....

i suppose there is a conflict with the

FlexGridSizer->Fit(this);
FlexGridSizer->SetSizeHints(this);

???

Not sure why you need those calls on the sizer.


Have you tried something like:
Code
        dlg->Fit();
        wxSize s=GetSize();
        if(s.y>700) //shrink if fitted height is more than 700
            dlg->SetSize(s.x,700);


Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: ScrollingDialog
« Reply #9 on: February 09, 2011, 06:50:27 pm »
It should work as for "real" wxDialogs.
We use it for almost all dialogs in C::B and it works correctly there (as far as I know).

Is this going to be redundant soon? http://docs.wxwidgets.org/trunk/overview_dialog.html#overview_dialog_autoscrolling
We hopefully do not longer need it, if we can switch to wx2.9/3.0.

Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #10 on: February 09, 2011, 06:57:41 pm »
I reach my aim with this call:

SetMaxSize(-1,700);

But, i receive the error message that i've posted...

The scrollingdialog is resized with this call...(but in runtime i've to click ignore to the error message...)where is the conflict??
« Last Edit: February 09, 2011, 08:19:05 pm by Rossifumi »

Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #11 on: February 10, 2011, 03:00:09 pm »
suggestions???

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: ScrollingDialog
« Reply #12 on: February 10, 2011, 03:25:42 pm »
suggestions???

This question seems not to be a C::B related question, because it looks like a problem with wxWidgets (in this case it would violate our forum rules).
But it can also be a problem with wxScrollingDialog or wxSmith, so here comes my next question.

Where do you try to set SetMaxSize with two integers as parameters ?
wxDialog or wxTopLevelWindow (the base class) has no such function (as far as I know).
Or is it just a typo ?
Do you set it directly or through the wxSmith resources ?

Which version of wxWidgets do you use (seems to be a debug-build) ?
What happens if you just ignore the alert (if possible) ?

Could you provide a minimal sample project where this happens ?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: ScrollingDialog
« Reply #13 on: February 10, 2011, 03:31:20 pm »
I just tested it with a debug-build of wxWidgets and get the exact same error, if I set max size and min size for the dialog in wxSmith's resources and have min size greater than max size.
But that's exactly what the error message said, so I guess  it's not as simple as this.

Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #14 on: February 10, 2011, 04:42:24 pm »
First of all...thank you for your help and your time... :D :D

Also...
- i tried to SetMaxSize,SetMinSize,SetSize in wxSmith resource(with integers of course)...

- and i tried in constructor of my scrollingdialog to call SetMaxSize(wxSize(-1,700)).

But i receive the same error.

I use a release-build of wxwidgets.

I can ignore the message...and the scrollingDialog is resized...
but i suppose that in definitive version of my .exe file i receive the alert too.
And that's my problem...because i can resize..(but i receive the alert)... :( :(
if you would i can send you my .h/.cpp files.




Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: ScrollingDialog
« Reply #15 on: February 10, 2011, 04:55:56 pm »
If possible please sen also the *.cbp, *.wxs and (probably *.xrc)-files.
You can either attach it her (if it's not too large) or send it to me  per mail (jens at codeblocks dot org).

If you really use a release build, I wonder why you get this warning, because the asserts are normally only enabled in debug-builds.

Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #16 on: February 10, 2011, 05:10:48 pm »
Here are the files..

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: ScrollingDialog
« Reply #17 on: February 10, 2011, 07:41:29 pm »
First: you use a debug version of wxWidgets (as I thought), that's why you get the assert message.
Second: you use wxWidgets 2.9.1 and most likely do not need wxSrollingdialog as dmoore stated above.
Third: the height of all child-elements together is greater than the maxsize and that leads to the warning, if you set the sizer.


Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #18 on: February 10, 2011, 08:18:56 pm »
1) i compiled the project in debug and releas mode, both, with the same error...is this that you mean with "debug version of wxWidgets"?
2) Yes i use wxWidgets 2.9.1, how can i obtain a scrolledwindow so?
3)I think that the height of all child-elemnts is ofcourse greater than the maxsize...in other way i don't need a scroll....

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: ScrollingDialog
« Reply #19 on: February 10, 2011, 08:55:20 pm »
1. Yikes. Your wxWidgets DLL was compiled with debugging symbols/code.
2. Read the link I posted earlier.
3. If you take a look at the code of wxScrollingDialog you will see it does its magic by dynamically moving the widgets in the dialog into a scrolling window, BUT ONLY when you call "Show" or "ShowModal". By forcing your dialog to resize using Fit and SetSizeHints in your constructor, you are creating a warning because there is no scrolling window to dump everything into, but you aren't changing the size of the dialog because all of that will be undone when you call Show. You will also notice that wxScrollingDialog is hard coded to set the size of the dialog to the lower of the size required to show it or the display size. If you want to do something different you could try something like override Show/ShowModal:

Code
bool YourDerivedDialog::Show(bool show)
{
    if (CanDoLayoutAdaptation())
        DoLayoutAdaptation();
    wxSize s=GetSize();
    SetSize(s.x,700);

    return wxDialog::Show(show);
}

Anyway, this really isn't C::B development related.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: ScrollingDialog
« Reply #20 on: February 10, 2011, 09:18:47 pm »
1) i compiled the project in debug and releas mode, both, with the same error...is this that you mean with "debug version of wxWidgets"?
You link against a debug library of wxWidgets, that's normally only needed if you want to debug wxWidgets itself.
2) Yes i use wxWidgets 2.9.1, how can i obtain a scrolledwindow so?
It should work as for "real" wxDialogs.
We use it for almost all dialogs in C::B and it works correctly there (as far as I know).
Is this going to be redundant soon? http://docs.wxwidgets.org/trunk/overview_dialog.html#overview_dialog_autoscrolling
3)I think that the height of all child-elemnts is ofcourse greater than the maxsize...in other way i don't need a scroll....
You misunderstood what a wxScrollingDialog does:
It's a drop-in replacement for wxDialog, that automatically adds scrollbars (and makes sure that standard buttons are always visible) if the dialog is larger than the screensize.
It's designed to make sure that all parts of a dialog are reachable on small screens like netbooks have.
See here: http://www.anthemion.co.uk/code.htm#scrollingdialog

Maybe it would be enough to use a wxScrolledWindow directly (I never did it), but we leave the scope of this forum here and should stop the discussion !

Rossifumi

  • Guest
Re: ScrollingDialog
« Reply #21 on: February 10, 2011, 09:56:01 pm »
Ok...thanks for the suggestions...