EditText Drag-n-Drop AND Keyboard input ?



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

    On 13/09/2004 at 22:23, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.503 
    Platform:   Windows  ;   
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    So, I can drag and drop objects onto the EditText in a dialog, but how do you get the text if the user types it in? Using Command(id,msg) and the EditText IDs does NOT work. Not only is there no activation, but no text entry at all.

    I'm getting some results with Message(msg) using msg->GetId() == BFM_ACTION, but it is called for each keystroke. How do I know when the text entry is finished?

    Thanks,
    Robert



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

    On 14/09/2004 at 04:27, xxxxxxxx wrote:

    Are you sure the command doesn´t work? It worked fine for me afai can remember.



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

    On 14/09/2004 at 07:42, xxxxxxxx wrote:

    Here's the code - you'll probably recognize most of it :). ID_DROPIT is a button, the other two are EditTexts. Like this, no text entry is possible, only drag-n-drop.

      
    FloorDialog::Message(msg)  
    {  
         if (msg->GetId() == BFM_DRAGRECEIVE)  
         {  
              if(CheckDropArea(ID_DRAGOBJECT, msg, TRUE, TRUE))  
              {  
                   SetDragDestination(MOUSE_POINT_HAND);  
                   if(msg->GetData(BFM_DRAG_FINISHED))  
                   {   
                        object = GetDragObject(msg);  
                        SetString(ID_DRAGOBJECT, object->GetName());  
                   }  
                   return TRUE;  
              }  
              else if(CheckDropArea(ID_DRAGTARGET, msg, TRUE, TRUE))  
              {  
                   SetDragDestination(MOUSE_POINT_HAND);  
                   if(msg->GetData(BFM_DRAG_FINISHED))  
                   {   
                        target = GetDragObject(msg);  
                        SetString(ID_DRAGTARGET, target->GetName());  
                   }  
                   return TRUE;  
              }  
         }  
         return super::Message(msg);  
    }  
    FloorDialog::Command(id, msg)  
    {  
         if (id == ID_DROPIT)  
         {  
              if (!object) return;  
              if (target) DropToTarget();  
              else DropToFloor();  
              object = NULL;  
              target = NULL;  
              SetString(ID_DRAGOBJECT,"");  
              SetString(ID_DRAGTARGET,"");  
         }  
         else if (id == ID_DRAGOBJECT)  
         {  
              if (!(object = GetActiveDocument()->FindObject(GetString(ID_DRAGOBJECT))))  
                   SetString(ID_DRAGOBJECT, "");  
         }  
         else if (id == ID_DRAGTARGET)  
         {  
              if (!(target = GetActiveDocument()->FindObject(GetString(ID_DRAGTARGET))))  
                   SetString(ID_DRAGTARGET, "");  
         }  
    }  
    

    Thanks,
    Robert



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

    On 14/09/2004 at 07:58, xxxxxxxx wrote:

    GetString(ID_DRAGOBJECT)

    This seems to be the problem. This will only return TRUE or FALSE and not the string. You need to pass a variable to store the resulting string.

    So Sth like this:

    String name;
    GetString(ID_DRAGOBJECT,name);
    if (!(object = GetActiveDocument()->FindObject(name)))
                   SetString(ID_DRAGOBJECT, "");

    It´s a bit "unhandy" that it works that way but that´s how it is unfortunately. I´d rather like to see the String be returned and optionally pass a boolean variable, but I cannot change this. :)



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

    On 14/09/2004 at 08:46, xxxxxxxx wrote:

    This is COFFEE. :)

    That's not what I see in the docs and examples:

    [string] GetString([int] id);

    is what is given for GeBaseDialog::GetString().

    If I use GetString(ID, name), C4D responds with "Too many parameters" every time that I type.

    Now, maybe I'm not getting something here. I know that one usually retrieves information such as text in an editbox after the dialog is closed by the user. But this is an asynchronous dialog, so I need to get the string when the user hits Enter, Tab, or changes focus. Obviously, this is not how Command() works in this situation. I haven't found any code that would outline how this is done. Maybe I should just check the EditText strings when the operation is called?

    Thanks,
    Robert



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

    On 14/09/2004 at 10:03, xxxxxxxx wrote:

    Upps, sorry my fault. I thought it was C++. Hmm, well it should work then just like this. Are you sure that the field has a value? I just tried it with a simple dialog and GetString(id) works fine for me. :-\



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

    On 14/09/2004 at 12:32, xxxxxxxx wrote:

    I just get the strings when ID_DROPIT is called and it appears to work both ways (dnd and kb entry).

    Thanks, Katachi!

    Robert


Log in to reply