ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to figure out, how to use wxWindows library. I want to create just simple application, that'll display selected image.
this is part of the code, that creates open file dialog and shoul display image into the frame....
Code:
void testFrame::OnOpen(wxCommandEvent& WXUNUSED( event) )
{
wxFileDialog *fileDialog = new wxFileDialog(this, "Vyber subor", "", "", "*.*", wxOPEN, wxDefaultPosition);
if( fileDialog->ShowModal() == wxID_OK)
{
//tak treba osetrit open
wxBitmap *bitmap = new wxBitmap();
bitmap->LoadFile(fileDialog->GetPath(), wxBITMAP_TYPE_XPM);
if(bitmap == false)
{
wxMessageBox( wxT("Nepodarilo sa otvorit subor s obrazkom"), wxT("CHYBA"), wxOK|wxICON_ERROR, this);
bitmap->~wxBitmap();
return;
}
wxMessageBox( wxT("Obrazok by mal byt nacitany"), wxT("Subor OK"), wxOK|wxICON_INFORMATION, this);
this->staticBitmap->SetBitmap(bitmap);
}
fileDialog->Destroy();
}
but when I try to compile, I get an error message:
Code:
*/home/psycho/myprogs/test/src/test.cpp:97: error: no matching function for call to `wxStaticBitmap::SetBitmap(wxBitmap*& )'
*/usr/include/wx/gtk/statbmp.h:44: error: candidates are: virtual void wxStaticBitmap::SetBitmap(const wxBitmap& )
right, ok so you are providing a pointer when it wants the direct object. I suck at pointers, but try either declaring as "const wxthiny bitmap" or dereference the pointer when you pass it- "SetBitmap(&bitmap)" don't blame me if that's wrong though! i'm a perl chap.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.