[lazarus] Patches to Shanes files

P Jean dit Bailleul jeanditbailleulp at em.agr.ca
Thu Jul 8 12:41:35 EDT 1999


Well perhaps a solution which is not the best one but...

newpchar := StrAlloc(Length(StringVar)+1);
For i:=1 To Length(AString) Do
  NewPChar[i - 1]:=AString[i];
NewPChar[Length(AString)]:=#0;

If does not work, you'l be in big troubles!


At 11:33 08/07/99 -0500, you wrote:
>hmmm...I was wrong.  The strPCopoy still doesn't work.
>
>Shane
>
>
>>>> "Shane Miller" <SMiller1 at stvgb.org> 07/08 11:08 AM >>>
>OK, here's the scoop.
>Notice in gtkint.pp I had commented out all the strdispose functions.
That's not good.  :-)
>Once I put those back in (for every StrPCopy there should be one) then the
strpcopy seemed to work fine.  However, then we get an error and it doesn't
run.
>
>It doees all the events then when trying to gtk_widget_show  the menu bar
it crashes!  I moved the gtk_widget_show stuff out of twincontrol and put a
InterfaceObject.IntSendMessage() call into TWinControl and now it crashes
in GTKINT.PP when it tries to do the gtk_widget_show.
>
>Any thoughts now?
>
>Shane
>
>
>>>> P Jean dit Bailleul <jeanditbailleulp at em.agr.ca> 07/08 10:25 AM >>>
>At 09:53 08/07/99 -0500, you wrote:
>>I did a 
>>writeln('Length of signal is '+Inttostr(Length(Signal)));
>>and that came out correctly.
>>
>>So, what I did was this.  I did a 
>>Writeln('Length of signal is '+Signal[0]);
>>and it always came out with 
>>Length of signal is
>
>try in the debugger to see the Signal[0]. if the length is 10, then it
>*should* be #10
>
>>Not sure how else to look at it....
>>
>>Shane
>>
>>
>>>>> P Jean dit Bailleul <jeanditbailleulp at em.agr.ca> 07/08 9:20 AM >>>
>>It seems that it is a problem a string length, not a problem of PChar. Can
>>you check the real length of the string ([0] if it's short string). I don't
>>know how FPC work with long string, in Delphi it's stored in [-1..0], but
>>you can't read it directly.
>>
>>At 13:57 07/07/99 -0500, you wrote:
>>>Didn't work.
>>>I do this now.
>>>
>>>
>>>procedure TCustomForm.Create(aowner : TComponent);
>>>begin
>>>stuff
>>>
>>>signal := #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0;
>>>Signal := 'clicked';
>>>InterfaceObject.SetCallBack(signal,Self);
>>>end;
>>>
>>>and when it copies it from the string it received in the parameters to a
>>pchar I still get the same crap.  Though sometime's the PChar is equal to
>>'clicke' instead of 'clicked'.  After I set that one I set a few others and
>>they are all screwed up.
>>>
>>>Shane
>>>
>>>
>>>end;
>>>
>>>
>>>>>> P Jean dit Bailleul <jeanditbailleulp at em.agr.ca> 07/07 1:29 PM >>>
>>>At 13:21 07/07/99 -0500, you wrote:
>>>>I display the stringvar and it has NO garbage init before OR after the
>>>conversion, yet the newpchar does.
>>>
>>>Perhaps you have more than one #0 character in the string, if so, fill the
>>>string with #0 characters and then copy data into it.
>>>
>>>>Shane
>>>>
>>>>
>>>>>>> "Michael A. Hess" <mhess at miraclec.com> 07/07 1:09 PM >>>
>>>>Shane Miller wrote:
>>>>> 
>>>>> I have fixed the problem with the events using a char array (sort of)
>>>>> by changing it to a PChar.
>>>>> 
>>>>> Here's the problem, even using a pchar and doing..
>>>>> 
>>>>> newpchar := StrAlloc(Length(StringVar)+1);
>>>>> StrPCopy(newPChar,StringVar);
>>>>> 
>>>>> I still get unwanted characters.  Why is this?  I'm not sure what the
>>>>> problem is.  I thought doing it this way would work.
>>>>
>>>>If the StringVar has garbage data at the end it will still be there
>>>>after the conversion to PChar.
>>>>
>>>>I'll give you a hand looking at this when I get home this afternoon.
>>>>
>>>>-- 
>>>>==== Programming my first best destiny! ====
>>>>
>>>>Michael A. Hess      Miracle Concepts, Inc.
>>>>mhess at miraclec.com   http://www.miraclec.com 
>>>>
>>>>_________________________________________________________________
>>>>     To unsubscribe: mail lazarus-request at miraclec.com with
>>>>                "unsubscribe" as the Subject
>>>>    archives at http://www.miraclec.com/list_archives/lazarus 
>>>>
>>>>_________________________________________________________________
>>>>     To unsubscribe: mail lazarus-request at miraclec.com with
>>>>                "unsubscribe" as the Subject
>>>>    archives at http://www.miraclec.com/list_archives/lazarus 
>>>>
>>>>
>>>
>>>
>>>JDB
>>>
>>>les opinions et recommandations exprimées dans ce courrier sont ceux de
>>>l'auteur, ils ne sont pas nécessairement endossés par Agritulture et
>>>AgroAlimentaire Canada
>>>--------------------------------------------------------------
>>>Philippe JEAN DIT BAILLEUL
>>>Agriculture & AgroAlimentaire Canada - Agriculture & AgriFood Canada
>>>Email : JeanDitBailleulP at em.agr.ca 
>>>Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp 
>>>Tel : +1 (819) 565 9174 poste 251
>>>Fax : +1 (819) 564 5507
>>>
>>>_________________________________________________________________
>>>     To unsubscribe: mail lazarus-request at miraclec.com with
>>>                "unsubscribe" as the Subject
>>>    archives at http://www.miraclec.com/list_archives/lazarus 
>>>
>>>_________________________________________________________________
>>>     To unsubscribe: mail lazarus-request at miraclec.com with
>>>                "unsubscribe" as the Subject
>>>    archives at http://www.miraclec.com/list_archives/lazarus 
>>>
>>>
>>
>>
>>JDB
>>
>>les opinions et recommandations exprimées dans ce courrier sont ceux de
>>l'auteur, ils ne sont pas nécessairement endossés par Agritulture et
>>AgroAlimentaire Canada
>>--------------------------------------------------------------
>>Philippe JEAN DIT BAILLEUL
>>Agriculture & AgroAlimentaire Canada - Agriculture & AgriFood Canada
>>Email : JeanDitBailleulP at em.agr.ca 
>>Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp 
>>Tel : +1 (819) 565 9174 poste 251
>>Fax : +1 (819) 564 5507
>>
>>_________________________________________________________________
>>     To unsubscribe: mail lazarus-request at miraclec.com with
>>                "unsubscribe" as the Subject
>>    archives at http://www.miraclec.com/list_archives/lazarus 
>>
>>_________________________________________________________________
>>     To unsubscribe: mail lazarus-request at miraclec.com with
>>                "unsubscribe" as the Subject
>>    archives at http://www.miraclec.com/list_archives/lazarus 
>>
>>
>
>
>JDB
>
>les opinions et recommandations exprimées dans ce courrier sont ceux de
>l'auteur, ils ne sont pas nécessairement endossés par Agritulture et
>AgroAlimentaire Canada
>--------------------------------------------------------------
>Philippe JEAN DIT BAILLEUL
>Agriculture & AgroAlimentaire Canada - Agriculture & AgriFood Canada
>Email : JeanDitBailleulP at em.agr.ca 
>Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp 
>Tel : +1 (819) 565 9174 poste 251
>Fax : +1 (819) 564 5507
>
>_________________________________________________________________
>     To unsubscribe: mail lazarus-request at miraclec.com with
>                "unsubscribe" as the Subject
>    archives at http://www.miraclec.com/list_archives/lazarus 
>
>_________________________________________________________________
>     To unsubscribe: mail lazarus-request at miraclec.com with
>                "unsubscribe" as the Subject
>    archives at http://www.miraclec.com/list_archives/lazarus
>
>_________________________________________________________________
>     To unsubscribe: mail lazarus-request at miraclec.com with
>                "unsubscribe" as the Subject
>    archives at http://www.miraclec.com/list_archives/lazarus
>
>


JDB

les opinions et recommandations exprimées dans ce courrier sont ceux de
l'auteur, ils ne sont pas nécessairement endossés par Agritulture et
AgroAlimentaire Canada
--------------------------------------------------------------
Philippe JEAN DIT BAILLEUL
Agriculture & AgroAlimentaire Canada - Agriculture & AgriFood Canada
Email : JeanDitBailleulP at em.agr.ca
Web : Http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp
Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507






More information about the Lazarus mailing list