Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Newbie needs help with wxStaticBitmap

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Newbie needs help with wxStaticBitmap
#3509
Posted by: 2004-03-15 07:56:38
Hi all! Im really new to wxWidgets, but have some experience with Borland and VC++ so Im not entirely new to the coding game..

To learn my way around this neat framework I have fiddled around with various widgets, but I cannot make wxStaticBitmap work. I have tried several ways, first by declaring a pointer in the frame class and create it in the constructor as usual. And I have looked at the controls-sample, but I cannot reproduce it in a way that works properly -- What am I doing wrong??

I know I should show you guys some code, but its all so messy now that I cant even read it myself : -- Basically what Im doing now is to declare two pointers in the frameclass, then putting these two lines in the constructor:

        thebmp=new wxBitmap(_T("test.bmp"),wxBITMAP_TYPE_BMP);
        thestatic=new wxStaticBitmap(this,-1,*thebmp,wxPoint(20,20));


Do I have to initialize a drawing surface or something? Ive banged my head to the wall for several days now so I found it appropriate to test the famed wx forums -- Please help :)

Oh by the way, Im using gcc on SuSE Linux with the X11 port of wxWidgets.
Message2. Re: Newbie needs help with wxStaticBitmap
#3512
Posted by: upCASE 2004-03-16 00:18:02
Hi!
I'd say that the answer might already have been given on the wxWidgets mailing list :)
I experienced problems like this before, where a widget didn't seem to appear on screen when setting it to default size. Working with sizers normally get's you out of trouble, but whenever something like this doesn't work: Try setting a size :)

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: Newbie needs help with wxStaticBitmap
#3518
Posted by: 2004-03-16 22:02:35
Thanks for answering my cries for help :)

I have tried to set the size before, but still changed the line to:

thestatic=new wxStaticBitmap(this,-1,*thebmp,wxPoint(20,20),wxSize(50,50));

But again to no avail..Also, the controls sample does not set any size, and I did try to modify it into displaying my bitmap. The only real difference I can see between my code and the sample code is that the sample loads a panel wich it displays the bitmap on, while I try to use the frame as parent directly. Seems like wxWidget doesnt like me very much..;)

If anyone has a better idea...ehh..Im still here :D

Vegard
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2024-10-8  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0