PA_Picture

View: New views
4 Messages — Rating Filter:   Alert me  

PA_Picture

by Richard Hastings :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello, I have some questions about the PA_Picture type, and reals on  
4D v11. All these issues relate to 4D v11.2 both Mac (OS 10.5.8) and  
Windows XP.

1. I'm calling PA_GetFieldProperties on a picture field, and the kind  
returned is 3, an unlisted value for PA_FieldKind in the v11  
PublicTypes.h file. A value of 3 is the old constant for a picture  
field, wheras I was expecting eFK_PictureField (=10) to be returned.  
Have I not understood this routine?

2. I can call PA_GetPictureField on this field, and PA_GetLastError  
indicates no error occurred, but I have a question about the  
PA_Picture returned. I don't know the picture length, and I need this  
to call routines like PA_PictureToGIF. Is there a way to determine the  
length?

3. Lastly, on a double value, I'm calling PA_FormatReal , but I get a  
crash in 4D. Here's how I'm calling it

PA_Unichar aFormat[256];
PA_Unichar aResult[256];

aFormat[0] = 0;
PA_FormatReal((double) 1.23, aFormat, aResult);

Am I doing anything wrong?

I've also tried a valid format string for aFormat (e.g. "###") with  
the same result of a crash within 4D. When I step through with the  
debugger, into PA_FormatReal, the crash occurs at the Call4D line.

Thanks for any help

Richard Hastings


**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/

    Get the speed and power of 4D v11 SQL
    before upgrade prices increase - http://www.4d.com

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************


Re: PA_Picture

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> All these issues relate to 4D v11.2 both Mac (OS 10.5.8) and Windows  
> XP.

Don't use v11.2, use v11.5MC3 or later. There are hundreds of bugs  
that have been fixed (many in the plugin SDK) since v11.2.


> 1. I'm calling PA_GetFieldProperties on a picture field, and the  
> kind returned is 3, an unlisted value for PA_FieldKind in the v11  
> PublicTypes.h file. A value of 3 is the old constant for a picture  
> field, wheras I was expecting eFK_PictureField (=10) to be returned.  
> Have I not understood this routine?

Sometimes 4D uses 3 as the type for pictures. Not documented  
unfortunately. Any time you test for eVK_Picture or eFK_PictureField  
you also have to test for 3 (I added a constant eVK_InternalPicture  
for that).


> 2. I don't know the picture length, and I need this to call routines  
> like PA_PictureToGIF. Is there a way to determine the length?

I haven't tested it, but I'm pretty sure PA_PictureToGIF and  
PA_ConvertPicture will no longer work under v11. To convert a picture  
to a given codec, use PA_ExecuteCommandByID with PICTURE TO BLOB.


> 3. Lastly, on a double value, I'm calling PA_FormatReal , but I get  
> a crash in 4D.
> Am I doing anything wrong?

Yes, using v11.2.  ;-)

This was fixed in later versions. You need to use the latest version  
of the plugin SDK as well, there are bugs in 4DPluginAPI.c that were  
fixed.

Kind regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org

**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/

    Get the speed and power of 4D v11 SQL
    before upgrade prices increase - http://www.4d.com

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************


Re: PA_Picture

by malist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 6.11.2009, at 9.10, Richard Hastings wrote:

> Hello, I have some questions about the PA_Picture type, and reals on  
> 4D v11. All these issues relate to 4D v11.2 both Mac (OS 10.5.8) and  
> Windows XP.
...

> 3. Lastly, on a double value, I'm calling PA_FormatReal , but I get  
> a crash in 4D. Here's how I'm calling it
>
> PA_Unichar aFormat[256];
> PA_Unichar aResult[256];
>
> aFormat[0] = 0;
> PA_FormatReal((double) 1.23, aFormat, aResult);
>
> Am I doing anything wrong?
>
> I've also tried a valid format string for aFormat (e.g. "###") with  
> the same result of a crash within 4D. When I step through with the  
> debugger, into PA_FormatReal, the crash occurs at the Call4D line.
>
> Thanks for any help
>
> Richard Hastings

XCode 3.2, OSX 10.6.1, 4DPluginAPI 11.4.

I think there are bugs in 4DPluginAPI. I had to use Boot to avoid  
PA_Eval... and PA_Format... crashes.


PA_Unichar result[256];
       
long day = 1827; // = days between 1.1.2000 - 1.1.1995
PA_FormatLongint( day, format_uchars, result);  // crash
       
double dbl = 12345.6;
PA_FormatReal( dbl, format_uchars, result );  // crash
       
short d,m,y;
d=3;
m=12;
y=2009;
       
PA_EvalDate ( str_uchars, &d, &m, &y );   // crash
       
long formatNum=2;
PA_FormatDate (d, m, y, (short)formatNum, result ); // d, m, y are  
short, can not be more than 32767   // crash


Regards,

Pasi Mankinen
       

**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/

    Get the speed and power of 4D v11 SQL
    before upgrade prices increase - http://www.4d.com

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************


Re: PA_Picture

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I think there are bugs in 4DPluginAPI.

There *ARE* bugs in the plugin SDK. If you find one report it at bugs.
4d.fr. They have been pretty good about fixing them.


> I had to use Boot to avoid PA_Eval... and PA_Format... crashes.

I had to give up on PA_Format also. I use PA_ExecuteCommandByID with  
the String command instead.

As for PA_Eval, I am using that heavily and have had no problems.


> short d,m,y;
> d=3;
> m=12;
> y=2009;
>
> PA_EvalDate ( str_uchars, &d, &m, &y );   // crash

Not sure why you are setting d/m/y before calling, they get set by  
PA_EvalDate. Are you sure str_uchars is NULL terminated?

Kind regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org

**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/

    Get the speed and power of 4D v11 SQL
    before upgrade prices increase - http://www.4d.com

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************