THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/06/2012 at 13:11, xxxxxxxx wrote:
I just noticed the forum supports YouTube videos. That's cool!
Here's a video showing what I'm doing with the Multi text box gui:fibU-B-yzK4
This is the code I used to make it:
LONG myDialog::Message(const BaseContainer &msg, BaseContainer &result)
{
String allWords; //This will hold the entire text in the textbox
GetString(1001,allWords);
String lastWord; //This will hold the last word that is typed into a text box
if (msg.GetId()==BFM_GETCURSORINFO)
{
String text;
if(GetString(1001, text))
{
LONG length = text.GetLength();
LONG pos = NULL; //The variable that will hold the postion of the string
Bool lastSpace = text.FindLast(" ",&pos, -1); //Find the last blank space and store it's position in the string
if(pos>0) //If there is at least one empty space found
{
String lw = text.SubStr(pos+1, length - pos); //Grab the last word (sub string)
lastWord = lw;
}
}
}
if (lastWord == "doc.")
{
String popupText;
LONG editX, editY, editW, editH; //Create variables to position the popup GUI
if(GetItemDim(1028, &editX, &editY, &editW, &editH)) //Queries a dialog control for its current size and position in pixels
{
if(Local2Screen(&editX, &editY))
{
BaseContainer entries; //Create a container to store the popup entries
entries.SetString(FIRST_POPUP_ID+0, "GetActiveDocument()");
entries.SetString(FIRST_POPUP_ID+1, "SetActiveDocument(BaseDocument* doc)");
entries.SetString(FIRST_POPUP_ID+2, "LoadDocument(const Filename& name, SCENEFILTER loadflags, BaseThread* thread)");
//Add more entries as needed
LONG mypopup = ShowPopupMenu(NULL, editX, editY+(editH+300), entries); //Creates & positions the popup GUI
if(mypopup!=NULL)
{
popupText += entries.GetString(mypopup); //Increment(step/loop) through each popup entry and get each value
SetString(1001, allWords + popupText); //Adds the user selected popup text into the textbox
}
}
}
}
return GeDialog::Message(msg,result);
}
I was able to write this in R12.
I'm still a learner, and the code is probably not very good. But there's already just enough text handling code in the SDK's to at least create this kind of thing in a basic form. Even from a relative newbie like me.
But anything the developers can think of to make writing this kind of thing easier and more robust would be very cool.
-ScottA