The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to show multiple lines using a textfeld

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Schmid Posted - 06/05/2006 : 5:33:34 PM
Origin Version (Select Help-->About Origin): Origin 7.5G SR3 v7.5853(B853)
Operating System: Windows XP SP2

I would like to set up a dialog box having a text edit and button control(GETN_BUTTON) and a text edit control(GETN_STR).When the user klicks on the butten control, then the programm calls the GetMultiOpenBox function for selecting files and returns the file paths. The pointing problem is that I expect to show the file paths back in the user interface. For that I've got 2 ideas:
1. show multiple lines through the text edit control(as ask in the title)
2. set up text edit controls according to how many files the user selected in the event handler function to show the file paths separately.

for idea 1, I'd like to ask whether it is possible to show multiple lines in a text edit control or with other controls in OrigenC.
for idea 2, my source codes are as follows:


bool main_interface()
{
GETN_TREE(tr)
GETN_BUTTON(Path, "OpenData", "C:\\")
if( !GetNBox(tr, "Open", NULL, NULL, EvHandler) )
return false;
}

bool EvHandler(TreeNode& tr, int nRow, int nType, Dialog& Dlg)
{
if(TRGP_STR_BUTTON == nType) // If Browse button clicked then open browse dialog
{
StringArray sPath;
GetMultiOpenBox(sPath, FDLOG_ASCII, NULL, NULL, "Open", false );
int nSize = sPath.GetSize();
if( nSize )
{
tr.Path.strVal = sPath[0];
string str;
for (int ii = 1; ii < nSize; ii++)
GETN_STR("Path" + ftoa(ii), "Data" + ftoa(ii),sPath[ii] )
}
return true;
}

return false;
}


After compiling, it reports always "Error, Variable "_tmpNode" not declared ".

So how can I realize my aim without having OriginPro. Any help will be greatly appreciated.










3   L A T E S T    R E P L I E S    (Newest First)
Schmid Posted - 06/07/2006 : 2:51:08 PM
Mike,
Thank you so much for your kind help.It's a pity that event handler can only change the values of existing nodes, but cannot define new nodes. That means we cannot set up new controls in the interface dynamically using GetN method. So I think your second solution should be the only way out along the way of my approach. Moreover, it happened to be the final solution I've found. Thank you again.
Mike Buess Posted - 06/07/2006 : 09:04:46 AM
Something more along the line of your original approach will work if you put a cap on the number of files that will be selected. This will show up to maxFiles files by creating all text controls at the start and hiding or showing as necessary...

void getnTest(int maxFiles = 32)
{
GETN_TREE(tr)
GETN_BUTTON(Path, "OpenData", "C:\\")
for(int i=0;i<maxFiles;i++)
{
TreeNode tn = tr.AddTextNode("","File" + (i+1));
tn.Show = false;
}
if( GetNBox(tr, "Open", NULL, NULL, EvHandler) )
{
out_tree(tr);
}
}

bool EvHandler(TreeNode& tr, int nRow, int nType, Dialog& Dlg)
{
if(TRGP_STR_BUTTON == nType && nRow >= 0)
{
StringArray sPath;
int nSize = GetMultiOpenBox(sPath, FDLOG_ASCII, tr.Path.strVal, NULL, "Open", false );
int maxFiles = tr.GetNodeCount() - 1;
if( nSize )
{
tr.Path.strVal = GetFilePath(sPath[0]);
for(int i=0; i<maxFiles; i++)
{
TreeNode tn = tr.GetNode("File" + (i+1));
tn.strVal = i<nSize ? sPath[i] : "";
tn.Show = i<nSize ? true : false;
}
}
return true;
}
return false;
}

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 06/07/2006 09:36:26 AM
Mike Buess Posted - 06/06/2006 : 4:30:15 PM
1. Origin 7.5's GetN dialog does not have a multiple-line text control. Closest thing is the drop-down list created by GETN_LIST.

2. The runtime error occurs because you cannot generate node labels for GETN_STR on-the-fly like you are trying to do. However, the primary reason that your approach will not work is that an event handler can only change the values of existing nodes. It cannot add new nodes (e.g., text controls) to the GetN dialog.

You'll probably have to do the file selection first and then create the GetN dialog in which to show the file list. The following code creates a drop-down list followed by individual text controls for each file. The runtime error you saw is avoided by using tr.AddTextNode instead of GETN_STR.

StringArray sPath;
GetMultiOpenBox(sPath, FDLOG_ASCII, NULL, NULL, "Open", false );
string sList;
sList.SetTokens(sPath,'|'); // create string for drop-down list
GETN_TREE(tr)
GETN_LIST(list, "File list", 0, sList) // drop-down list
for(int i=0; i<sPath.GetSize(); i++)
{
TreeNode tn = tr.AddTextNode(sPath[i],"File" + (i + 1)); // text control
}
if( GetNBox(tr, "Open", NULL, NULL, NULL) )
{
out_tree(tr);
}

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000