Entries Tagged as ''

Working through the wxWidgets Tutorial:: Widgets I: wxBitmapButton

Ok… I need to get this train moving again….
The is the sample code that threw me for a little loop..
I notice that Bitmap button doesn’t automatically resize… My first bitmap was rectangular in shape and than the others where square. I was messing a round a deleted the default file it was expecting… Everything else showed blank when a different file should have been displayed… When it hit the file it couldn’t find a message box was displayed… It didn’t crash which was good…

I left default mute.png intact renamed med.png so it wouldn’t be recognized see what happened. Thenon-crashing error message appeared and the prior image remained.
Ok… There’s another situation that’s occuring that I’m going to wrap my head around… C::B’s puts an executable in a folder Bin/Debug. This particular program loads up 4 png files… When I run from the IDE it looks to the source directory for the PNG files…. Yet another todo to figure out.

It seems sort of curious that the tutorial mentions that it’s possible the wxbitmapbutton to have three states:Selected, focused and displayed, but doesn’t and that you can have images for each… If I had more time I’d explore some more of that….

Misc Stuff. Wxwidget bugs… Et all

I ran across what I think is a bug in wxframe… I wanted to come up with a single file deployment to see if people on ubuntuforums are also seeing this. anyway..


Anyway… I really like that Inkscape stuff.. It works nice..
I need to move along here in my studies… I running out of vacation time.

Zetcode , Code::Blocks,OCC and Caffeine

Ok,,,, Normally, when I head out to my mom’s I stay overnight and head back the next day.. But because of some family commitments I had to head back tonight…. For most of my life I’ve been a night owl, but for the last 6 months because of our child’s kindergarten, I routine what up 5-6am without an alarm…. Anyway I was worried about dozing off I drank a pot of coffee before the return trip…. So….. I would say I”m somewhat over caffeinated and tired at the moment. It’ll be interesting if this post makes any sense in the morning…
On another note… Apparently, the stormy night before Christmas that I got my mom to bring her to our house, apparently there was a family in her neighborhood that was involved in a fatal accident because of the weather… Makes you think about how much we take life for granted and how everything could radically change in an instant.

I was checking out my posts on the wxwidget forum and found someone interested in OCC. Go figure..
Anyway never did get to play with wxBitmap.. Caffeine is starting to wear off… Time for bed….

Working through zetcodes wxwidget tutorial:Widgets I

Ok… This looks like a real interesting section. Unfortunately, I think my quiet time is about up and the house is about to wake up… But… We’ll give it a try and see how far we get…
So currently I’m at this point in the zetcode tutorial.
This section goes over the widgets in general… Lets see…
Specfically it reviews:

  • WxCheckBox
  • WxBitmapButton
  • WxToggleButton
  • WxStaticLine
  • WxStaticText
  • WxSlider

Oh… The dogs are stirring…. and my no-so little one….. Hmmm….
Perhaps we have a few minutes… Nope..

But…. There is always the next day :)

Lets see about the check box…

Main point, check box is on or off.

Basically this code, changes the title of the frame when the check box is clicked. One thing that seems for of strange to me is that frame does not clear with this->SetTitle(wxT(“”));
Huh…
I think I just ran across my first wxWidgets bug. I just signed up on wxforums and made my first post

WxBitmapButton
Ok.. To get this demo to work I need a few png images…

…..

  if (pos == 0) {
      button->SetBitmapLabel(wxBitmap(wxT("mute.png"), wxBITMAP_TYPE_PNG));
  } else if (pos > 0 && pos <= 30 ) {
      button->SetBitmapLabel(wxBitmap(wxT("min.png"), wxBITMAP_TYPE_PNG));
  } else if (pos > 30 && pos < 80 ) {
      button->SetBitmapLabel(wxBitmap(wxT("med.png"), wxBITMAP_TYPE_PNG));
  } else {
      button->SetBitmapLabel(wxBitmap(wxT("max.png"), wxBITMAP_TYPE_PNG));
  }
}

I have a mute.png in the system… so I just copied it into my directory… On the others I planning on firing up the Gimp and did some quick artwork….
Ok… I’m hitting some snags here….
I believe a compiled program would look in the same directory the executable to find mute.png I think I need to add something to the compiler to get it to look there…. Ok… Where the heck is that…
I did a little surfing and I came up with this: http://www.pnelsoncomposer.com/FAQs/wxWidgetsFAQ.html

Ok… As they say: me bad…
I have spend alot of time barking up the wrong tree…. I was banging my head against my desk trying to figure out why some sample code wasn’t compiling actually the issue was linking. So… I wound up posting:
http://ubuntuforums.org/showthread.php?t=1022891

oh… and here….

http://wxforum.shadonet.com/viewtopic.php?t=22351

and lets not stop there…. How about here:

http://forums.codeblocks.org/index.php/topic,9833.0.html

I don’t think I’ll do that to many times….
I found a hackers guide to asking questions….
http://www.catb.org/~esr/faqs/smart-questions.html#classic

Yikes… I thing I’ll crawl back in my hole now…

There is a bunch of things I need to test out in the wxbitmap tutorial… But that’s something I’m going to try tomorow.

Moving a top panel back to the top in ubuntu linux.

So I just spent about an hour trying to get my top panel back to the top.  Somehow I got a window underneath the top panel and I moved the top panel to the right.  Now the darn thing is that the top panel got stuck and I couldn’t move it back.  I think I got too much stuff crammed in there to grip hold of anything.

I found a very helpful link here: http://www.mattcutts.com/blog/moving-the-locked-top-panel-in-ubuntu-gnome/#comment-207576

I learned a few new things….
Alt-F2 will bring up a run-command.. (Seems like you could just open up a terminal to do the same thing, but I guess some people don’t like that)
To move the top panel from top to right
gconf-editor
/apps/panel/toplevels/top_panel
adjust “orientation” from “right” to “top”

On a side note…. If you want to blow a lot of time… This blog is rather entertained… Be forwarned it is not Rated-G: http://linuxhaters.blogspot.com/2008/06/evolution-of-ubuntu-user.html

Ok… Now after wasting a bunch of time…. Back to wxWidgets.

Working through zetcode’s wxwidget tutorial: Dialogs (Continued)

This morning I was going through my post’s in ubuntu forum’s and found that someone else was having simliar problems was with playing Maelstrom on Ubuntu… http://ubuntuforums.org/showthread.php?t=864356
I’ve been so focused on the wxwidget stuff, I sort gave up on my sound not working.. Anyway… I followed the link, tried the instructions and still got a no go on the sound. But I’m feeling a little bit more optimistic about this…
One thing I find a little bit frustrating about all this, is that even the simplest things take time… I burned 2 1/2 hours of my precious quiet time on trying to get the sound working…. I’m struck by how ironic that sounds..

Anyway… Lets see if I can finish my review of Dialogs tutorial…
Lets see where did I leave off. Font Dialog.
Lets see what the sample code does.
Ok… Simple app.. It changes the font of some static text.
The static text it “The Agoge” Learn something new every day. Looks like a good scrabble word…
Back to the task at hand…
Pretty straightforward kind of stuff..
Once again.. Accessing the font dialog looks real easy..
Also, this example show’s how to connect up a menu event…
It’s a tutorial worth looking at.
Lots of stuff will come in handy here…

Ok.. On to the next example..
I went through the sample for Custom Dialog.. Everything is fairly straight forward..
I googled “What is the difference between wxWidget and wxDialog and found this link:
http://groups.google.com/group/comp.soft-sys.wxwindows/browse_thread/thread/ce753431fa1d962e/62a25866db625a24?lnk=raot

So essentially a wxDialog can be modal and wxFrame can’t (along with a couple of other minor issues)

Do that completes my review of Dialogs… To Widgets I we go.

Working through zetcode’s wxwidget tutorital: Dialogs

I’m sort getting anxious to get through this tutorial and start doing some actual coding…
I’ve been thinking about some of the projects I could do…. Ultimately, my goal is to get my C++ skill sets up to the point where I can start playing around with Opencascade effectively. I read somewhere that it could take a couple of years of experience to get dangerous with this stuff..
Anyway, I have a C++ time saving techniques for dummies that I’ve had checked out of the library for a while. I think I may have blogged about perhaps doing a Gui front ends for the examples.. That would be good learning practice…

Also, years ago I did a fun project in vb for 4 bar linkages in VB6. I think it would be an interesting exercise do convert this to C++ wxwidgets. I did a search on 4 bar linkages and happened to have ran into this site, which I think is pretty awesome. This guy is to say the least is very interesting:http://www.martindalecenter.com/Calculators4_2_Mech.html

So… Anyway my quiet time is almost up… It’s Christmas morning lets see if a can pop off a little of this section before the house wakes up…;)
Ok…
I’m looking through this section it show the following:

  • Predefined dialogs which you can tweak. Yes/No, OK kind of stuff.  Different icon’s can plopped on.
  • WxFileDialog which seems to be wxwidgets equivalent to a vb6 common dialog control… Very cool
  • WxFontDialog this is pretty much self explanatory.
  • Custom dialog control. todo (Need to understand difference/usage between wxDialog and wxFrame’s

Alrighty, I’m going to try to rip through this section in record time
Predefined dialogs points of interest:
This application shows for command buttons: info, error, question, Alert, which when pressed open up an appropriate dialog.
Note to self.. why no pretty icon on the main buttons?? Saw that somewhere in the tutorial.
This is pretty much the equivalent of a vb6 messagebox.  Documentation on usage is here.

WxFileDialogs point of interest:
This is sort of a cool simple example. Main window with a “file->Open” pulldown menu and a muli-line wxTextCtrl
Click on the file open the standard WxfileDialog opens up.
Now this is more vb’ish… Up to know it seems like you had to do many lines of code to get anything done. This seems to be far more terse:

void Openfile::OnOpen(wxCommandEvent& event)
{

wxFileDialog * openFileDialog = new wxFileDialog(this);

if (openFileDialog->ShowModal() == wxID_OK){
wxString fileName = openFileDialog->GetPath();
tc->LoadFile(fileName);
}
}

tc is defined in the constructor… This is more like it…

Ok… enough of that on to wxFontDialog. Well maybe a little later… The house has now awoken…

Working through zetcodes wxwidget tutorial, events.

I think this will be my 102 posting… Wow what ride ;)
So yesterday, I was playing around in XP.. Today I’m back in Linux.

So…. I’ve been working in the events section of the zetcode tutorial called “Example using Connect”. I had convinced myself that there was a bug in this code because of a cryptic error message. It turns out that I missed copying over the semicolon at the end of class declaration. (That was sort of embarrassing to me so, I’m keeping that post private.) After all that I found the example to be sort of lame. The move event only kicks in when the frame is moved. I was sort of hoping to see the position update when the mouse moved across the frame. I tried to play with that a little. I’m not quite there yet. todo (figure out how to do that after getting through the tutorial). It’s sort of funny, apparently, this has been on my mind. I found another one of my todo’s when I was googling, looking for the same thing. I’ll get there..

The next section in the tutorial is event propagation. This is vaguely familiar but different. Skip event or something..
Lets see copying the code over and executing.
Ok… Main point here is to get an event to travel from button to panel to frame via the skip event.

The next text application in the tutorial is something called veto. This might be handy in a my bag of tricks. In this instance, a custom close event handler stops the closing of a frame and you given a message box with the option to quit with a yes/no.
Actually, it’s a nice little code section to create the equivalent of a vb msgbox.

After veto comes a nice little section about windows identifiers.
Main points from zetcode

Window identifiers are integers that uniquely determine the window identity in the event system. There are three ways to create window id’s.

* let the system automatically create an id
* use standard identifiers
* create your own id

Each widget has an id parameter. This is a unique number in the event system. If we work with multiple widgets, we must differantiate among them.

This is pretty much a rehash of stuff I’ve seen in the tutorial… Only thing is the mention of GetId() which gets you access to the window identifier (for example if the system assigned one)..

I must say this example looks might pretty in Linux.
Finally done with this section on to Dialogs…….

Code::Blocks WxWidgets and XP (Continued)

This post picks up from here

Ok… So I’m picking my mom up for Christmas and it’s early in the morning and of course I’m on the computer..
But first I need to make some coffee.
Darn things is I copied my password down wrong and I can’t get in my blog…
So I storing this in google docs and I’ll copy it over later on.

Last time I was at this was Thanksgiving.  http://www.metalshaperman.com/?p=104

Hopefully, this time I’ll keep better notes..
I fired up code::blocks and created a default wxformbuilder project to see if it would compile.

Close but no cookie..

So…. the compiler error looks like this:

||=== test, Release ===|
C:\wxWidgets-2.8.9\include\wx\platform.h|196|wx/setup.h: No such file or directory|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|103|#error “wxUSE_DYNLIB_CLASS must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|111|#error “wxUSE_EXCEPTIONS must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|119|#error “wxUSE_FILESYSTEM must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|127|#error “wxUSE_FS_ARCHIVE must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|140|#error “wxUSE_DYNAMIC_LOADER must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|148|#error “wxUSE_LOG must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|156|#error “wxUSE_LONGLONG must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|164|#error “wxUSE_MIMETYPE must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|180|#error “wxUSE_PRINTF_POS_PARAMS must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|188|#error “wxUSE_PROTOCOL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|230|#error “wxUSE_REGEX must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|238|#error “wxUSE_STDPATHS must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|246|#error “wxUSE_XML must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|254|#error “wxUSE_SOCKETS must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|262|#error “wxUSE_STREAMS must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|270|#error “wxUSE_STOPWATCH must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|278|#error “wxUSE_TEXTBUFFER must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|286|#error “wxUSE_TEXTFILE must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|302|#error “wxUSE_URL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|310|#error “wxUSE_VARIANT must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|330|#error “wxUSE_ABOUTDLG must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|338|#error “wxUSE_ACCEL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|346|#error “wxUSE_ANIMATIONCTRL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|354|#error “wxUSE_BITMAPCOMBOBOX must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|362|#error “wxUSE_BMPBUTTON must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|370|#error “wxUSE_BUTTON must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|378|#error “wxUSE_CALENDARCTRL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|386|#error “wxUSE_CARET must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|394|#error “wxUSE_CHECKBOX must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|410|#error “wxUSE_CHOICE must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|418|#error “wxUSE_CHOICEBOOK must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|426|#error “wxUSE_CHOICEDLG must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|434|#error “wxUSE_CLIPBOARD must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|442|#error “wxUSE_COLLPANE must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|450|#error “wxUSE_COLOURDLG must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|458|#error “wxUSE_COLOURPICKERCTRL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|466|#error “wxUSE_COMBOBOX must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|474|#error “wxUSE_COMBOCTRL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|482|#error “wxUSE_DATAOBJ must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|490|#error “wxUSE_DATAVIEWCTRL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|498|#error “wxUSE_DATEPICKCTRL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|506|#error “wxUSE_DIRPICKERCTRL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|514|#error “wxUSE_DISPLAY must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|522|#error “wxUSE_DOC_VIEW_ARCHITECTURE must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|530|#error “wxUSE_FILEDLG must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|538|#error “wxUSE_FILEPICKERCTRL must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|546|#error “wxUSE_FONTDLG must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|554|#error “wxUSE_FONTMAP must be defined.”|
C:\wxWidgets-2.8.9\include\wx\chkconf.h|562|#error “wxUSE_FONTPICKERCTRL must be defined.”|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options…|
||=== Build finished: 50 errors, 0 warnings ===|

I found some information at this link:http://www.wxwidgets.org/docs/faqmsw.htm#setuph

It says:

Why do I get errors about setup.h not being found?

When you build the wxWidgets library, setup.h is copied from include/wx/msw/setup.h to e.g. lib/vc_msw/mswd/wx/setup.h (the path depends on the configuration you’re building). So you need to add this include path if building using the static Debug library:

lib/vc_lib/mswd

or if building the static Release library, lib/vc_lib/msw.

See also the wxWiki Contents for more information.

So…this led me to here:

http://wiki.wxwidgets.org/Compiling_WxWidgets

Ok… I want to display the files that have setup.h here..
So… I need to go start->run and type in cmd..

Type type cd :\ to get to the root dir.
then I entered dir *setup.h/s >junk.txt

Volume in drive C has no label.
Volume Serial Number is 2075-ABF8

Directory of C:\wxWidgets-2.8.9\contrib\include\wx\deprecated

08/06/2007  04:42 PM             2,034 setup.h
1 File(s)          2,034 bytes

Directory of C:\wxWidgets-2.8.9\include\msvc\wx

08/06/2007  04:41 PM             9,263 setup.h
1 File(s)          9,263 bytes

Directory of C:\wxWidgets-2.8.9\include\wx\msw

05/19/2008  08:51 AM            46,122 setup.h
1 File(s)         46,122 bytes

Directory of C:\wxWidgets-2.8.9\include\wx\msw\wince

05/19/2008  08:51 AM            43,883 setup.h
1 File(s)         43,883 bytes

Directory of C:\wxWidgets-2.8.9\include\wx\univ

11/19/2007  09:55 AM            42,674 setup.h
1 File(s)         42,674 bytes

Directory of C:\wxWidgets-2.8.9\samples\ipc

08/06/2007  04:45 PM               880 ipcsetup.h
1 File(s)            880 bytes

Total Files Listed:
6 File(s)        144,856 bytes
0 Dir(s)  45,401,522,176 bytes free

Ok… I think I need to build the library..

I went to this link: http://wiki.wxwidgets.org/Compiling_WxWidgets_With_MSYS-MinGW
and followed the instructions.
Ok… So I’m being asked which components to install.
I’m not sure this is correct but I selected:
MinGw base tools
g++ compiler
MinGw make

I accepted the default C:\MinGw destination folder.
Also the MinGw Start folder.

The next thing in the instructions tells me to download MSYS.
It appears that I have 3 possibilities.  I chose MSYS Base System, dated August 27,2008 which appears to be the most current.

Ok… I’m not sure what to do here….  I was sort of hoping for a .exe but it appears that everything is a tar…
Ok…. It seems that if you go to the bottom, you’ll find an .exe one less than the latest and greatest..
So….. I choose
MSYS-1.0.10.exe

Is clicked on a MSYS desktop icon and got what looks like a Linux termimal….
Next per the instructions I went to
change to the directory you installed the wx source to
cd c:wxWidgets-2.8.9
mkdir msw-debug
cd  msw-debug
../configure --disable-shared --enable-debug
make

…. This seems to be taking a while…. Probably time to go out and shovel some snow…

make install

Back to shoveling.

Ok…
The next instruction didn’t work for me:
test your build. If you see a windows application open up, your wxWidgets has built correctly ($ cd samples/minimal; make && minimal.exe).
I tried:
make minimal and it tried to do the follow the following:
g++ minimal.cpp -o minimal

It squacked abouh the being able to find wx/wxprec.h among other things.

I searched for wxprech.h and found it in a couple of places… But unfortunately, my fun time is over ;(
I think something is buggered on my search paths… I need to look at this later
More on this later….

(Part 3)Exploring zetcode wxwidget tutorial on Layout Management:

I think I’ve been lingering in this section for a little too long. The next section of this tutorial deals with wxGridSizer.   Not that I’m not enjoying this tutorial.  It’s just I want to get through it and start coding…

Ok.. Lets see, points about wxGridsizer..   Rows and columns are all the same size.  If you need variable column, row with use flexgrid.
Constructor looks like this:

wxGridSizer(int rows, int cols, int vgap, int hgap)

This sample is the front end for a calculator.

I must be starting to learn this stuff. Nothing is really jumping out at me as new

Actually, the next widget in the tutorial is starting to get interesting to me. Its the Wxflexgrid control.
In Vb6 the hierarchical flexgrid control in my tool of choice… I wonder what type of functionality this thing has…
For now, I’m just doing through the tutorial for basic functionality…

Pretty routine stuff… I know that there will be some pearls of wisdom that I glossed over but I really want to move this along here… because events is next…..