How to change the label text box position.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-08-13
10:59 AM
- last edited on
2021-09-14
09:21 AM
by
Noemi Balogh
2021-08-13
10:59 AM
Hello,
In a custom add-on i tried to change the all label text box position. To do this task i used ACAPI_Element_GetElemList to get all the Label text box guid. And after collect guids i accessed all related property of every individual Label text box using ACAPI_Element_Get. And the i change the label.endC.x and label.endC.y position. But the problem is when i change them every label text box get inw new position but the size of that text box get small and the texts of that text box get delete accept the first letter of that text box text.
Here i shared my current method to do this task.
In a custom add-on i tried to change the all label text box position. To do this task i used ACAPI_Element_GetElemList to get all the Label text box guid. And after collect guids i accessed all related property of every individual Label text box using ACAPI_Element_Get. And the i change the label.endC.x and label.endC.y position. But the problem is when i change them every label text box get inw new position but the size of that text box get small and the texts of that text box get delete accept the first letter of that text box text.
Here i shared my current method to do this task.
void Do_Label_Edit(short NewPositionvalue) { GSErrCode err; GS::Array<API_Guid> LabelList; short check = 0; err = ACAPI_Element_GetElemList(API_LabelID, &LabelList); short totalLabels = LabelList.GetSize(); // Get the layout Info for (GS::USize i = 0; i < LabelList.GetSize(); i++) { //Do //Change the level boxes position API_ElementMemo memo; API_Element element, mask; BNZeroMemory(&element, sizeof(API_Element)); BNZeroMemory(&memo, sizeof(API_ElementMemo)); element.header.guid = LabelList; // First listed item index element.header.typeID = API_LabelID; err = ACAPI_Element_Get(&element); if (err != NoError) { ErrorBeep("ACAPI_Element_Get", err); return; } ACAPI_ELEMENT_MASK_CLEAR(mask); ACAPI_ELEMENT_MASK_SET(mask, API_LabelType, endC); if (element.label.labelClass == APILblClass_Text) { ACAPI_ELEMENT_MASK_SET(mask, API_LabelType, u.text.loc); element.label.u.text.loc = { 10.5, 3.5 }; } else if (element.label.labelClass == APILblClass_Symbol) { ACAPI_ELEMENT_MASK_SET(mask, API_LabelType, u.symbol.pos); element.label.u.symbol.pos = { 10.5, 3.5 }; } element.label.endC.x = 10.5; element.label.endC.y = 3.5; err = ACAPI_Element_GetMemo(element.header.guid, &memo); if (err != NoError) { ErrorBeep("ACAPI_Element_GetMemo", err); return; } err = ACAPI_CallUndoableCommand("crate new from last drawing", [&]()->GSErrCode { err = ACAPI_Element_Change(&element, &mask, &memo, 0, true); return err; }); if (err == NoError) { check++; } ACAPI_DisposeElemMemoHdls(&memo); } return; // Do_Label_Edit }It will be helpful to me if i get any way to solve this problem.
Labels:
- Labels:
-
Add-On (C++)
0 REPLIES 0