cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Type conversion GS::Unistring to GS::uchar_t[]

Hey everyone,

i need to set a GDL param value from my addon and i struggle to define my new value with the correct type.

UInt32 totalParams = BMGetHandleSize((GSConstHandle)memo.params) / sizeof(API_AddParType);
for (int i=0; i<totalParams ;i++){
   GS::UniString pname = ((*memo.params).name);
   if (pname=="search name"){
      GS::UniString old_value = (*memo.params).value.uStr;
      (*memo.params).value.uStr = "???????";   // how to set this
   }
}
As i understand (*memo.params).value.uStr gives me an array of GS::uchar_t values. How is the correct constructor for something like this
GS::uchar_t my_chars[5] = ???; 
or can i convert a GS::Unistring to an uchar_t array? uchart_t seemes to be just a Utf16Char but i lack the understanding of those types. Any help would be aprreciated.

Thanks in advance!

Edit:
(*memo.params).value.uStr = "???????"; will not work but i found the example in the docs for APIAny_​OpenParametersID so i will use that. The question of the type conversion still reamains.
1 Solution

Accepted Solutions
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
One example from the Element_Test example Add-On:
const GS::UniString tmpUStr ("TestName");
GS::ucscpy ((*memo.params)[ii].value.uStr, tmpUStr.ToUStr ());

Go to post

2 Replies 2
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
One example from the Element_Test example Add-On:
const GS::UniString tmpUStr ("TestName");
GS::ucscpy ((*memo.params)[ii].value.uStr, tmpUStr.ToUStr ());
Anonymous
Not applicable
As allways, thank you very much Tibor! It's sometimes hard to find the things you are looking for in the examples so thank you for pointing that out as well.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!