Displaying image in Dialog?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2003 at 10:28, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.012 
    Platform:      
    Language(s) :     C++  ;

    ---------
    I'll ask this again but in reference to C++.  How do you display an image (xxx.tif) in a Dialog?  Basically, I want something like:
    +---------------------------+
    +---------------------------+
    |                           |
    | [IMAGE]   text text       |
    |                           |
    |       [dlg_group]         |
    +---------------------------+
    Don't you just love my art? :)
    Robert Templeton



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2003 at 12:07, xxxxxxxx wrote:

    Found the reference to using BitmapButtonCustomGui in an earlier message. 
    Please update the documentation soon! ;0)
    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2003 at 14:56, xxxxxxxx wrote:

    You can easily use a UserArea to do so. It´s far less complicated. U can then use DrawBitmap to draw a bitmap into the userarea and AttachUserArea to attach the user area to the dialog. Pretty logical isn´t it? :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2003 at 15:51, xxxxxxxx wrote:

    Actually, the BitmapButtonCustomGui was easy enough.  Everytime I try to use GeUserArea (COFFEE and C++), it ends up just showing a teeny-tiny gray smudge where the image is supposed to be.  Seems to me that something in the area's size is not getting set properly (?) even though I'm deriving my own class from it and calling Draw() with DrawBitmap() inside (as well as AddUserArea() and AttachUserArea() in the dialog CreateLayout()).
    Maybe  they can provide more code examples for the intricacies of the C++ SDK when they update the documentation.
    Thank,
    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2003 at 15:59, xxxxxxxx wrote:

    did you manage it to show a bitmap for the bitmapButtonCustomGui? I couldn´t make it work. It works fine using the Struct in my objectplugin but doesn´t work for me in a dialog. How did you get the image to be shown?
    Samir



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2003 at 17:37, xxxxxxxx wrote:

    Oh yeah! :)  Here's the code:

        
        
        
        
        Bool ErrorDialog::CreateLayout()  
        {  
         Bool cancel = FALSE;  
         BitmapButtonCustomGui* erroricon;
        
        
        
        
         StatusSetText(GeLoadString(ERROR_STATUS_TEXT));  
         SetTitle(GeLoadString(ERROR_DIALOG_TITLE));  
         GroupBegin(5000, BFH_CENTER, 2, 2, NULL, 0);  
         {  
          // some room for the icon  
          GroupBorderSpace( 8, 8, 8, 8 );  
          {  
           BaseContainer settings;  
           settings.SetBool(BITMAPBUTTON_BUTTON,TRUE);  
           erroricon  = (BitmapButtonCustomGui* )AddCustomGui(4000,CUSTOMGUI_BITMAPBUTTON,String(),BFH_FIT,0,0,settings);  
          }  
          if (erroricon) erroricon->SetImage(GeGetPluginPath() + Filename("res") + Filename("erroricon.tif"));  
          GroupBegin(5001, BFH_CENTER, 1, 2, NULL, 0);  
          {  
           switch(errtype)  
           {  
            case ERROR_MEMORY:  
             AddStaticText(4001,BFH_CENTER|BFV_CENTER,0,0, GeLoadString(ERROR_MEMORY_TEXT),BORDER_NONE);  
             AddStaticText(4003,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);  
             break;  
        
        
        
        
        
        blah(blah,blah)...
        
        
        
        
            default:  
             break;  
           }  
          }  
          GroupEnd();  
          AddStaticText(4004,BFH_CENTER|BFV_CENTER,0,0,"",BORDER_NONE);  
          if (cancel) AddDlgGroup(DLG_OK|DLG_CANCEL);  
          else AddDlgGroup(DLG_OK);  
          GroupSpace(0,8);  
         }  
         GroupEnd();  
         return TRUE;  
        }  
        
    

    Note that I'm actually loading the image during the creation of the dialog. Probably not the best approach, but then error dialogs *shouldn't* (hehe) appear too often.  The important stuff is between GroupBorderSpace(8,8,8,8) and GroupBegin(5001,...).
    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/02/2003 at 03:23, xxxxxxxx wrote:

    Hi,
    upps, you didn´t have to show the whole function :)
    Thanks anyway, I had acutally the same. Difference was that I set the image in my Init function and not in the layout creation method. That was the fault.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/02/2003 at 11:25, xxxxxxxx wrote:

    Hey,
    Just trying to give some context. :)
    I have a couple of quick questions, not related to the topic, but in an effort not to start too many threads, I'll ask here.
    Information on the BaseFile methods is sparse.  Basically, to "reuse" code already written for Java, I'd like to keep the same program flow for reading and parsing a file.  In Java, I was reading lines (until EOLs) from the file and using StringTokenizer() to break them apart for interrogation.  So, here are the questions:
    1. How do you determine the EOF condition?  Currently, I'm just checking the BaseFile.GetPosition() against a stored BaseFile.GetLength().  Is this the standard method in the SDK?
    2. BaseFile.ReadString() appears from the code to read everything in the file, not just lines.  Is this true and, if so, what is a good method to do just read lines?  Currently, I'm using BaseFile.ReadChar() until it reads an EOL in a ReadLine method of my own, but it does get messy on the EOF condition.
    Thanks,
    Robert "pampered by Java" Templeton ;)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/02/2003 at 12:18, xxxxxxxx wrote:

    1. I´m doing it the same way. Not sure if there is something to determine the EOF otherwise. Of course you could check with GetError if the EOF was reached before your writing or reading was finished but don´t know if it´s adviseable (and useful for your project).
    2. I guess GeGetLineEnd(void) is what you might use in this case. You can then check for a carriage-return or line feed (or both). But I don´t think ReadString will read the entire file, but not sure. Not working with files too much. :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/02/2003 at 12:56, xxxxxxxx wrote:

    1. I'll stick with this method then.  The Bool IsEOF() { return (basefile->GetPosition() == (filelen-1)); } method is simple enough (note that filelen-1 is not actually used since filelen is modified into compliance before this). :)
    2. GeGetLineEnd() only handles Strings and am having no problem determining EOL in file, just looking to see if there was a way to read lines from file without using my own routine.  If it ain't broke, don't fix it - but optimize the heck out of it anyway! ;)
    BTW, does the SDK code have any Exception handling built in, like for GeAlloc, AutoAlloc, etc?  I'd rather use exceptions where feasible (especially when class constructors fail).  My classes will use them but wanted to see if theirs do also.
    Also, if you're interested in working with files at some point ;) or just need to tokenize strings (since I can't figure out where the actual SDK String class buffer is located, 'strings' means a null-terminated CHAR* array), I'm writing a StringTokenizer class that works basically like strtok(string line, string delim) or Java's StringTokenizer class.  Let you know when it's complete and working properly.
    Take care,
    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/02/2003 at 13:21, xxxxxxxx wrote:

    The C4D SDK doesn't use exception handling, so it's dangerous to let any exceptions escape (read: C4D will crash from unhandled exceptions). By default exception handling is turned of in the MSVC project. If you turn it on you have to put try/catch blocks around places where exceptions are likely to occur.
    And please don't hesitate to start new threads. That's much easier than having to dig into a mega thread looking for questions.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/02/2003 at 13:50, xxxxxxxx wrote:

    Those exceptions will never escape! NEVER! ;0)
    Okay, I'll just be careful that I put my 'throw's where necessary and try{}catch{} all expected methods/errors.  After using exceptions extensively in Java, this is not an issue.
    So far, the C++ SDK is working well.  MSVC throws up 'warnings' when using gNew, but thought I had read that this was not a detriment.  All in all, I'm back in the seat of C++ programming (Yeeehaaaw!) and the pace is good.
    Moi? Hesitate in starting new threads?  Now you've asked for it... ;0)
    Thanks, Mikael
    Robert


Log in to reply