Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

wxImage components

<< < (3/3)

Jenna:

--- Quote from: rcoll on April 29, 2009, 07:47:55 am ---I reviewed the dialog code, and the only thing I can think of that might have something to do with this is the "OnPaint" events, which might get called non-stop on some systems.

--- End quote ---

If I saw it right yesterday evening (it was a little late), it's indeed in "OnPaint", but on 64-bit linux, and that can make a difference.
I will have a look into it this evening.

Jenna:
Sorry for the late response.

The following patch works for me:


--- Code: ------ wxSmithImage.orig/wxsImageListDialog/wxsImageListDialog.cpp 2009-04-13 19:31:06.000000000 +0200
+++ wxSmithImage.work/wxsImageListDialog/wxsImageListDialog.cpp 2009-05-02 20:42:34.000000000 +0200
@@ -852,7 +852,8 @@
 
     iw = aBitmap.GetWidth();
     ih = aBitmap.GetHeight();
-
+    if(iw < 0 || ih < 0)
+        return;
     aPanel->GetClientSize(&pw, &ph);
 
 // set scale to fit in panel

--- End code ---

wxWidgets returns -1 for as width and height for empty bitmaps (at least on 64-bit linux), that leads to endless while-loops.

rcoll:

--- Quote from: jens on May 02, 2009, 08:59:22 pm ---The following patch works for me:

     iw = aBitmap.GetWidth();
     ih = aBitmap.GetHeight();
-
+    if(iw < 0 || ih < 0)
+        return;
     aPanel->GetClientSize(&pw, &ph);

--- End quote ---

Good catch!  I drink a toast to your coding acumen (please pour yourself a beer).

I added your patch to the code, and now I'm searching for similar code in all my projects.

Ringo

rcoll:
This is an update to the earlier wxSmithImage package; this update contains a new component "wxImageTreeCtrl" that allows an individual bitmap from a wxImageList to be assigned to each item in the tree.

The wxImageTreeCtrl uses a much better editor/dialog to give the programmer greater control over the appearance of each item in the tree.

The wxBitmapCombo has been updated to use a much better editor/dialog also.

As before, these items have been developed and tested only on Windows XP, but I believe they should work with little or no changes on Linux.

See the ReadMe.txt file for details on using each component.

Everything was developed using wxWidgets 2.8; I don't know how it will work with 2.9 or later.

If you have any suggestions for improvement, please let me know and I'll make updates as soon as I can.

Ringo

[attachment deleted by admin]

Navigation

[0] Message Index

[*] Previous page

Go to full version