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
 Displaying multiple lines in GETN_BUTTON

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
couturier Posted - 10/31/2014 : 09:45:21 AM
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
7   L A T E S T    R E P L I E S    (Newest First)
couturier Posted - 11/01/2014 : 05:49:26 AM
Wow. This is brilliant.

Thank you so much.
Castiel Posted - 11/01/2014 : 03:41:41 AM
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;
}


©c¡Ï   ¤È¥¹  ©f¨u©c  ©c¥ì    ¥Î¤³  ©c/     ©¦£¯
 ©c¨Ê¥Î ¤´¥¨  ¥ó ¨×   ¥ó¤á' ¥Ì©¦¥­   /¤í  ¥Õ©¦©f
   ¨Ö             ¦á          ©¦£þ  ©` ¥Õ   ©¦
                              ©¦
Castiel Posted - 11/01/2014 : 03:22:16 AM
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);


©c¡Ï   ¤È¥¹  ©f¨u©c  ©c¥ì    ¥Î¤³  ©c/     ©¦£¯
 ©c¨Ê¥Î ¤´¥¨  ¥ó ¨×   ¥ó¤á' ¥Ì©¦¥­   /¤í  ¥Õ©¦©f
   ¨Ö             ¦á          ©¦£þ  ©` ¥Õ   ©¦
                              ©¦
couturier Posted - 10/31/2014 : 6:51:20 PM
@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 ?
greg Posted - 10/31/2014 : 4:24:06 PM
FYI
Castiel's code requires
#include <GetNbox.h>
to compile.
Castiel Posted - 10/31/2014 : 12:42:48 PM
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..

©c¡Ï   ¤È¥¹  ©f¨u©c  ©c¥ì    ¥Î¤³  ©c/     ©¦£¯
 ©c¨Ê¥Î ¤´¥¨  ¥ó ¨×   ¥ó¤á' ¥Ì©¦¥­   /¤í  ¥Õ©¦©f
   ¨Ö             ¦á          ©¦£þ  ©` ¥Õ   ©¦
                              ©¦
greg Posted - 10/31/2014 : 12:08:01 PM
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$=;

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