axapta - get help text of system command button? -


how can helptext of system command button , use class browse node of form , helptext of controls contained in form, have not use tooltip method cause use formrun object , doesn't work correctly , degrades performance

i use program :

runnode = treenode::findnode(#formspath); form = runnode.aotfindchild("name of form "); formbuilddesign = form.design(); formgridcontrol = formbuilddesign.control("deletecode"); idx= formgridcontrol.id(); args = new args(); args.object(form);   // create run-time form. // formrun = classfactory.formrunclass(args);    formrun.init();    formgridcontrol = formrun.control(idx);   info(strfmt("helptext: %1",syslabeledit.findlabel("fr",formrun.control(idx).tooltip())));   works first time , after make ax crash 

thank's in advance

your code crashes when call init() method second time. can use treenodetraversercontrols class traverse control nodes of form design. following example demonstrates this:

static void gethelptextfromnewbutton(args _args) {     #aot     #properties     treenode formnode, treenode;      treenodetraversercontrols traverser;      formnode = treenode::findnode(#formspath + "\\custtable\\designs\\design");      traverser = new treenodetraversercontrols(formnode);      while(traverser.next())     {         treenode = traverser.currentnode();          if(treenode.aotname() =="cmdbtncustomernew")         {             info(strfmt("helptext: %1 %2",treenode.aotgetproperty(#propertyhelptext), syslabel::labelid2string(treenode.aotgetproperty(#propertyhelptext), "fr")));         }     } } 

as can see uses syslabel::labelid2string method label in language of choice. better using syslabeledit. using code, unnecessary construct actual form , should possible run code in batch.

edit: command buttons don't have text label set, label indeed empty, because property doesn't contain label. in case can command property in same way text property:

treenode.aotgetproperty(#propertycommand) 

this return integer value can switch on. simple return label used command button because same "create new record" in en-us. not believe helptext , label property defined in ax somewhere can automatically retrieve it. defined in kernel text data files. can find these in bin directory of aos. take axsysen-us.ktd file example. search "#1001". lists labels used command buttons in en-us. similar file exists other languages. new button, entry reads:

0x0104 &new | create new record 

the "0x0104" id of command can see when selecting command on command button. 0x0104 heximal representation of 260, propertycommand property return in ax.

edit 2: alternative, use code work tooltip(), return label, in 1 language:

args args; formrun formrun;  args = new args(); args.name(formstr(custtable));  formrun = classfactory.formrunclass(args); formrun.init();  info(strfmt("helptext: %1",formrun.control(formrun.controlid("cmdbtncustomernew")).tooltip())); // ok info(strfmt("helptext: %1",syslabel::labelid2string(formrun.control(formrun.controlid("cmdbtncustomernew")).tooltip(), "fr"))); // nok 

the problem tooltip not return label cannot translate it.

edit 4: way, can use code translate text en-us fr:

info(syslabel::labelid2string(syslabeledit.findlabel("en-us", syslabel::seachstringbuildexactstr(formrun.control(formrun.controlid("cmdbtncustomernew")).tooltip())), "fr")); 

you on right track using syslabeledit after all. i'm unsure if labels used command buttons available translated labels though.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -