Problems, problems, problems
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-28
03:04 PM
- last edited on
2023-08-07
10:41 AM
by
Doreena Deng
2007-03-28
03:04 PM
Hy. I've just run acroos a very ... interesting problem. I'm trying to create Text and Label objects from an API script. The Memo.textContent field of the object shoud contain something like 119.45, 280.14, etc. Instead of the expected result, the object contains something like 119ÌÌÌÌÌÌÌÌÌsÌÌÌ or 280ÌÌÌÌÌÌÌÌÌÌÌÌÌ. The really tricky part is that I don't always get these amazing results, because the script runs as expected in 50% of the situations. Could this be a database related issue that I haven't figured out yet or it's just me on a wrong way to init pointer string variables in VC++?
Labels:
- Labels:
-
Add-On (C++)
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-30 01:14 PM
2007-03-30
01:14 PM
Marius wrote:Are you allocating space for the handle to store your text when you construct the memo fields? What you are describing suggests your text has been overwritten, which is likely to occur if you haven't allocated space for it - you could easily cause a crash when writing the text to an unallocated handle too. If this is the case, take a look at BMAllocateHandle for a start.
I'm trying to create Text and Label objects from an API script. The Memo.textContent field of the object shoud contain something like 119.45, 280.14, etc. Instead of the expected result, the object contains something like 119ÌÌÌÌÌÌÌÌÌsÌÌÌ or 280ÌÌÌÌÌÌÌÌÌÌÌÌÌ.
Ralph.
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-30 01:51 PM
2007-03-30
01:51 PM
Well, it works. I was using memset function. From now on I'll try to search for an Archicad API function to use instead of the ordinary C++ functions each time I'm in trouble.
Thanks a lot! Again!
Thanks a lot! Again!

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-30 02:30 PM
2007-03-30
02:30 PM
Marius wrote:memset wouldn't be appropriate anyway because it doesn't allocate a block of memory either - that function simply replicates a char for a specified number of times starting at a specified location.
Well, it works. I was using memset function. From now on I'll try to search for an Archicad API function to use instead of the ordinary C++ functions each time I'm in trouble.
By all means get to know what the API offers and use it. In the context of ArchiCAD development it will save you time and headaches, and improve compatibility as ArchiCAD changes.
I recommend that you look closely at the ArchiCAD API String Manager too.
Ralph Wessel BArch
Central Innovation
Central Innovation