Set text value to StringEdit control on Form

Hi,

I have my own Form. On which I am providing the facility to browse for the particular Folder using winAPI::BrowseForFolder functionality of AX. Now after selecting the specific folder and then click on OK button it will assign the folder path to my StringEdit control which shows the browsed folder path.

Please give some suggestions.

Thanks,

Ashlesh

Any str field in ax with extended datatype filepath will automaticly do this, or am I missing the question?

Hi Ashlesh,

you can use this code for selectfolder and set text

str filePath;

;

filePath = winAPI::browseForPath(element.hWnd(),“Select folder”);
if (filePath != “”)
StringEdit.text(filePath);

Regards

Hi Selo,

Your reply is helpful to me. Thank you.

But still I am getting the error. Please have a look on the image i have attached to review my work flow.

Please review it and let me know if you are not able to view the image.

Thanks for everything.

Ashlesh

hey,

you have to set Yes for txtWmDatafolder AutoDeclaration propertie, after then you can access this control in the code scope.

regards.

If you don’t want the button you could just set the string-edit method’s extendedDataType to FilePath.

This vill get you a nice folder-button right by the field automatic.

You may have to add a method to the forms method by the name filePathLookupTitle

It may look like:

str filePathLookupTitle()
{
return ‘Lookup Title: Boll’;
}

This would result in:
Here the field is just a stringedit, not connected to any database/table

Hi Selo,

Thank you very much.

It works great.[:)]

Regards,

Ashlesh

Oscar,

Thanks for the wonderful suggestion.

Actually i required to get the selected Folder path not File path. So to set the ExtendedDataType property to “FilePath” I can select File path but not the Folder Path which is expected by me.

Regards,

Ashlesh

Hi,

I am facing one more problem. while I am setting the browse button Text property to “…” it shows the some different value after open the form. I have attached its image here kindly go through it.

Thanks in advance.

Regards,

Ashlesh

filepath is what I think you refer to as folder-path

I can’t choose a file, only folders. So I won’t get c:\files\textfil.txt, because I only se folders when I browse. So I can only get c:\files\

Hi Oscar,

Gr8. It works fine.[:)]

Regards,

Ashlesh

Oscar,

When i am setting the ExtendedDataType property to “FilePath” it automatically get the “Directory :” caption in front of my textbox.

Can you please suggest me some way to hide this “Directory :” caption.

Thanks,

Ashlesh

Well, on the stringedit you could enter a label in the properties. Or set the property showlabel to no.

Directory is the default label of the Filepath extended datatype. That’s why it appears in front

/Oscar

Hi,

Thanks,

It works fine.

Thanks for all your support,

Ashlesh