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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Displaying multiple lines in GETN_BUTTON
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

couturier

France
291 Posts

Posted - 10/31/2014 :  09:45:21 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2015
Operating System: win7 64

I'd like to have a dialog in which I could display selected files in a multiline textbox, just as in impASC dialog
For now, the closest I came to was the use of GETN_BUTTON triggering GetMultiOpenBox() but it will only display a single line.

Couldn't find anything in help and forum about that.

Thanks

greg

USA
1378 Posts

Posted - 10/31/2014 :  12:08:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You might be interested in some new LabTalk dialog capabilities:

// Initiallize
string sFile, sFiles, sPath, sSave, sSheet, sSheets, sColumn, sColumns, sGraph, sGraphs, sReport;
sFile$ = "";
sFiles$ = "";
sPath$ = C:\Users\;
sSave$ = C:\;
sSheet$ = "";
sSheets$ = "";
sColumn$ = "";
sColumns$ = "";
sGraph$ = "";
sGraphs$ = "";
sReport$ = "";

// Call dialog
getn
(Pick a File) sFile$:@BBFile
(Pick Multiple Files) sFiles$:@BBFiles
(Pick a Path) sPath$:@BBPath
(Get a Save Name) sSave$:@BBSave
(Pick a Sheet) sSheet$:@BBSheet
(Pick Multiple Sheets) sSheets$:@BBSheets
(Pick a Column) sColumn$:@BBColumn
(Pick Multiple Columns) sColumns$:@BBColumns
(Pick a Graph) sGraph$:@BBGraph
(Pick Multiple Graphs) sGraphs$:@BBGraphs
(Pick a Report) sReport$:@BBReport
(New Browse Buttons);

// Results
ty \x5bResults\x5d;
sFile$=;
sFiles$=;
sPath$=;
sSave$=;
sSheet$=;
sSheets$=;
sColumn$=;
sColumns$=;
sGraph$=;
sGraphs$=;
sReport$=;
Go to Top of Page

Castiel

343 Posts

Posted - 10/31/2014 :  12:42:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by couturier

Origin Ver. and Service Release (Select Help-->About Origin): 2015
Operating System: win7 64

I'd like to have a dialog in which I could display selected files in a multiline textbox, just as in impASC dialog
For now, the closest I came to was the use of GETN_BUTTON triggering GetMultiOpenBox() but it will only display a single line.

Couldn't find anything in help and forum about that.

Thanks



void MultilineEditWithButton()
{
    GETN_BOX(trMultilineEditWithButton);
    TreeNode tn = GETN_CURRENT_NODE.AddNode("MultilineEdit");
    tn.SetAttribute(STR_ID_ATTRIB, TRGP_STR_BUTTON);
    tn.SetAttribute(STR_LABEL_ATTRIB, "File Name");
    tn.SetAttribute(STR_COMBO_ATTRIB, "...Files");    // Files/Sheets/Graphs/Columns/Matrices
    tn.SetAttribute(STR_MULTI_EDT_EXPSHR_ATTRIB, 1);
    tn.SetAttribute(STR_ATTRIB_MULTILINE_EDIT_DISPLAY_ROW_HEIGHT_RANGE, "5-12");
    tn.SetAttribute(STR_ATTRIB_EDIT_DISPLAY_WIDTH_RANGE, "50-100");
    GetNBox(trMultilineEditWithButton)
}


Single edit line when it's file/sheet/graph/column/matrix. Multiple lines when pl..

妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

greg

USA
1378 Posts

Posted - 10/31/2014 :  4:24:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
FYI
Castiel's code requires
#include <GetNbox.h>
to compile.
Go to Top of Page

couturier

France
291 Posts

Posted - 10/31/2014 :  6:51:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
@Castiel
Thanks a lot Castiel, this is exactly what I was looking for.
I have a few additionnal questions
- Could you tell me where is the corresponding help documentation ?
- Is there an option to specify file type ?
- Is there a way to dynamically add items in the GETNBOX, based on the number of selected files ? Sort of like the impExcel Xf that dynamically add GETN_CHECK items for each sheet of the selected file.

@Greg
Thanks for those examples.
The release notes don't mention it. Is there a full documentation of the new features ?

Edited by - couturier on 10/31/2014 6:57:30 PM
Go to Top of Page

Castiel

343 Posts

Posted - 11/01/2014 :  03:22:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by greg

FYI
Castiel's code requires
#include <GetNbox.h>
to compile.



And "Pick a Report" requires
run.loadoc("OriginLab\nlsf_utils.c",16);


妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

Castiel

343 Posts

Posted - 11/01/2014 :  03:41:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by couturier

@Castiel
Thanks a lot Castiel, this is exactly what I was looking for.
I have a few additionnal questions
- Could you tell me where is the corresponding help documentation ?
- Is there an option to specify file type ?
- Is there a way to dynamically add items in the GETNBOX, based on the number of selected files ? Sort of like the impExcel Xf that dynamically add GETN_CHECK items for each sheet of the selected file.

@Greg
Thanks for those examples.
The release notes don't mention it. Is there a full documentation of the new features ?



  • No documentation, as far as I can see.

  • File type:


    • "...Files:ASCII"

    • "...Files:[ASCII (*.dat,*.txt)] *.dat;*.txt|[All (*.*)] *.*"]


  • See GetN_option_event().



void MultilineEditWithButton()
{
    GETN_BOX(trMultilineEditWithButton);
    TreeNode tn = GETN_CURRENT_NODE.AddNode("MultilineEdit");
    tn.SetAttribute(STR_ID_ATTRIB, TRGP_STR_BUTTON);
    tn.SetAttribute(STR_LABEL_ATTRIB, "File Name");
    tn.SetAttribute(STR_COMBO_ATTRIB, "...Files:[ASCII (*.dat,*.txt)] *.dat;*.txt|[All (*.*)] *.*");
    tn.SetAttribute(STR_MULTI_EDT_EXPSHR_ATTRIB, 1);
    tn.SetAttribute(STR_ATTRIB_MULTILINE_EDIT_DISPLAY_ROW_HEIGHT_RANGE, "5-12");
    tn.SetAttribute(STR_ATTRIB_EDIT_DISPLAY_WIDTH_RANGE, "50-100");
    tn.SetAttribute(STR_ATTRIB_HANDLER, GetN_option_event);
    GetNBox(trMultilineEditWithButton);
}

bool GetN_option_event(TreeNode& myTree, int nRow, int nType, Dialog& theDlg)
{
    if((TRGP_STR_BUTTON == nType || ONODETYPE_EDIT_BOX_ONELINE_TEXT == nType)&& nRow >= 0)
    {
        string strPath = myTree.MultilineEdit.strVal;
        StringArray sa;
        strPath.GetTokens(sa,'\n');
        if(myTree.selected.IsValid())
            myTree.selected.Remove();
            
        if(sa.GetSize())
        {
            myTree.AddNode("selected");
            for(int i = 0; i < sa.GetSize(); i++)
            {
                if(!sa[i].IsEmpty())
                {
                    TreeNode tnCheck = myTree.selected.AddNode("fileName"+(i+1));
                    tnCheck.SetAttribute(STR_ID_ATTRIB, TRGP_CHECK);
                    tnCheck.nVal = 1;
                    tnCheck.SetAttribute(STR_LABEL_ATTRIB, GetFileName(sa[i]));
                }
            }
            if(!myTree.selected.Children.Count())
                myTree.selected.Remove();
            else if(myTree.selected.Children.Count() > 1)
                myTree.selected.SetAttribute(STR_LABEL_ATTRIB, "Selected Files");
            else
                myTree.selected.SetAttribute(STR_LABEL_ATTRIB, "Selected File");
        }

        return true;
    }
    else
        return false;
}


妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

couturier

France
291 Posts

Posted - 11/01/2014 :  05:49:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Wow. This is brilliant.

Thank you so much.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000