Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-07

Patches to Shanes files

49 messages · 11 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Cliff Baeseman

Compiles on windows also after I commented the gtk_signal_destroy in gtkint.pp..

Does it do anything on your system. On windows it throws a ton of gtk errors and unloads..

Cliff

Earlier message 53 lines
-----Original Message----- From: Michael A. Hess To: Lazarus-List Date: Tuesday, July 06, 1999 9:40 PM Subject: [lazarus] Patches to Shanes files >Greetings, > >OK Shane I patched the files so that they compile. You can get the files >patched at: > > ftp://ftp.miraclec.com/lazarus/lazarus_patch.zip > >I have to say that I think the InterfaceObject is extra overhead for not >much gain. If you will notice I edited the file to remove the >superfluous code. Those extra create and destroy didn't do anything so >there is no reason to have them. So this InterfaceObject doesn't really >get you anything over my GUIAPI object. The only difference is the use >of the #ifdef. This means that the interfaces.pp file will have to be >rewritten anytime someone wants to add a new API. If you wanted it so >that you could have a radio button in Lazarus IDE that would be >interesting but that means you will have to edit the Lazarus IDE >interface just to add a new API. With my version all you would have to >do is indicate a different location for the guiapi unit that you wanted >to link to. > >I realize it is 6 of one half a dozen of the other but I think it will >get more complicated having to add additional #ifdefs for each API. But >hey that is just my choice. > >What I added was the InitProcedure sequence so that when the method >application.initialization is called in lazarus.pp it calls the code to >start up gtk or whatever API the InitProcedure is pointing to. > >I also made InterfaceObjects a self creating unit. It creates and >distroys the InterfaceObjects object itself. So I remove the code from >TControl that did this. > >Enough for me tonight. It is just tooooo dang hot out here on the east >coast. 8-| > >-- >==== Programming my first best destiny! ==== > >Michael A. Hess Miracle Concepts, Inc. > http://www.miraclec.com > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus >

Reply by email

Michael A. Hess
to Cliff Baeseman
Cliff Baeseman wrote
Compiles on windows also after I commented the gtk_signal_destroy in gtkint.pp..

It compile in Linux without doing that.

Does it do anything on your system. On windows it throws a ton of gtk errors and unloads..

Yeah it does the same thing on Linux. Once I got everthing to compile I was to done in to try and figure out why all the gtk-warnings were cropping up. Since that was what Shane did I thought I would leave it to him to see why that stuff was messing up.

I'll start looking at it again tomorrow. I have to be up at 5:30 and was goint to bed over and hour ago. Typical. :-)

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Michael A. Hess

Greetings,

OK Shane I patched the files so that they compile. You can get the files patched at:

ftp://ftp.miraclec.com/lazarus/lazarus_patch.zip

I have to say that I think the InterfaceObject is extra overhead for not much gain. If you will notice I edited the file to remove the superfluous code. Those extra create and destroy didn't do anything so there is no reason to have them. So this InterfaceObject doesn't really get you anything over my GUIAPI object. The only difference is the use of the #ifdef. This means that the interfaces.pp file will have to be rewritten anytime someone wants to add a new API. If you wanted it so that you could have a radio button in Lazarus IDE that would be interesting but that means you will have to edit the Lazarus IDE interface just to add a new API. With my version all you would have to do is indicate a different location for the guiapi unit that you wanted to link to.

I realize it is 6 of one half a dozen of the other but I think it will get more complicated having to add additional #ifdefs for each API. But hey that is just my choice.

What I added was the InitProcedure sequence so that when the method application.initialization is called in lazarus.pp it calls the code to start up gtk or whatever API the InitProcedure is pointing to.

I also made InterfaceObjects a self creating unit. It creates and distroys the InterfaceObjects object itself. So I remove the code from TControl that did this.

Enough for me tonight. It is just tooooo dang hot out here on the east coast. 8-|

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Cliff Baeseman
I got it to work under windows... I just had to make a call to
InterfaceObject.Init in TForm.Create();

Works slick....

Cliff

Earlier message 74 lines
-----Original Message----- From: Cliff Baeseman To: Date: Tuesday, July 06, 1999 10:16 PM Subject: Re: [lazarus] Patches to Shanes files >Compiles on windows also after I commented the gtk_signal_destroy in >gtkint.pp.. > >Does it do anything on your system. On windows it throws a ton of gtk errors >and unloads.. > >Cliff >-----Original Message----- >From: Michael A. Hess >To: Lazarus-List >Date: Tuesday, July 06, 1999 9:40 PM >Subject: [lazarus] Patches to Shanes files > > >>Greetings, >> >>OK Shane I patched the files so that they compile. You can get the files >>patched at: >> >> ftp://ftp.miraclec.com/lazarus/lazarus_patch.zip >> >>I have to say that I think the InterfaceObject is extra overhead for not >>much gain. If you will notice I edited the file to remove the >>superfluous code. Those extra create and destroy didn't do anything so >>there is no reason to have them. So this InterfaceObject doesn't really >>get you anything over my GUIAPI object. The only difference is the use >>of the #ifdef. This means that the interfaces.pp file will have to be >>rewritten anytime someone wants to add a new API. If you wanted it so >>that you could have a radio button in Lazarus IDE that would be >>interesting but that means you will have to edit the Lazarus IDE >>interface just to add a new API. With my version all you would have to >>do is indicate a different location for the guiapi unit that you wanted >>to link to. >> >>I realize it is 6 of one half a dozen of the other but I think it will >>get more complicated having to add additional #ifdefs for each API. But >>hey that is just my choice. >> >>What I added was the InitProcedure sequence so that when the method >>application.initialization is called in lazarus.pp it calls the code to >>start up gtk or whatever API the InitProcedure is pointing to. >> >>I also made InterfaceObjects a self creating unit. It creates and >>distroys the InterfaceObjects object itself. So I remove the code from >>TControl that did this. >> >>Enough for me tonight. It is just tooooo dang hot out here on the east >>coast. 8-| >> >>-- >>==== Programming my first best destiny! ==== >> >>Michael A. Hess Miracle Concepts, Inc. >> http://www.miraclec.com >> >>_________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus >

Reply by email

Shane Miller

I'm using sysutils in gtkint.pp not strings.

Shane

>> 07/07 3:54 PM >>>
Payne Thomas E CNIN wrote 16 lines
FYI This works with 0.99.12a of win32 ---------------------- program test; {$mode objpas} uses strings; var newpchar : Pchar; stringvar : String; begin stringvar := '>hello<'; newpchar := StrAlloc(Length(StringVar)+1); StrPCopy(newPChar,StringVar); writeln(string(newpchar)); end.

This is Correct.
In objpas mode a pchar can be typecast to a shortstring.

Show quoted text 16 lines
---------------------- This does not --------------------- program test; {$mode delphi} uses strings; var newpchar : Pchar; stringvar : String; begin stringvar := '>hello<'; newpchar := StrAlloc(Length(StringVar)+1); StrPCopy(newPChar,StringVar); writeln(string(newpchar)); end.

In delphi mode, you can't typecast a pchar to a SHORTstring. You can, however, do it if you use the -Sh switch or {$H+} so the string is an ansistring. I that case the program works correctly.

For both cases:

1) The typecast isn't needed. You can directly write the value of the pchar.
2) NEVER use the 'strings' unit if you use ansistrings; the strings unit returns shortstrings only. If you do this, you get an additional conversion to ansistring.
Instead, use the 'sysutils' unit; it has the same routines as 'strings', only with ansistrings.

Michael.

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Payne Thomas E CNIN

FYI

This works with 0.99.12a of win32
----------------------
program test;
{$mode objpas}
uses strings;
var
  newpchar : Pchar;
  stringvar : String;
begin
  stringvar := '>hello<';
  newpchar := StrAlloc(Length(StringVar)+1);
  StrPCopy(newPChar,StringVar);
  writeln(string(newpchar));
end.
----------------------
This does not
---------------------
program test;
{$mode delphi}
uses strings;
var
  newpchar : Pchar;
  stringvar : String;
begin
  stringvar := '>hello<';
  newpchar := StrAlloc(Length(StringVar)+1);
  StrPCopy(newPChar,StringVar);
  writeln(string(newpchar));
end.
---------------------

Tom

Show quoted text 30 lines
-----Original Message----- From: Shane Miller Sent: Wednesday, July 07, 1999 2:47 PM To: Subject: Re: [lazarus] Patches to Shanes files Another thought. Instead of calling InterfaceObject.Callback(some_string,self) should we be using something like LM_CLICKED and LM_SHOW? That way if the names for QT (or other tools) aren't the same as gtk's names the qt folks (when writing the interface) should be able to simply use the global variables to know what signal we are referring to. This would make gtkint.pp have a few more lines i.e. case Message of lm_show : signal := 'show'; lm_hide : Signal := 'hide'; lm_resize : Signal := 'size-allocate'; etc. Shane _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Shane Miller

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 07/07 1:29 PM >>>
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.

Show quoted text 39 lines
Shane >>> "Michael A. Hess" 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. http://www.miraclec.com _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail 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 :
Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

John Margaglione
to Shane Miller: I have fixed the problem with the events using a char array (sort of) by changing it to a…

I was having the same problem a while ago. Are you using AnsiStrings? I remember that PChar worked well with AnsiStrings, but that the StrAlloc method would remember extra junk, no matter how I initialized the string before copying.

John

Earlier message 98 lines
----- Original Message ----- From: Shane Miller To: Sent: Wednesday, July 07, 1999 12:50 PM Subject: Re: RE: [lazarus] Patches to Shanes files > 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. > > Please help.... > > Shane > > > >>> "Baeseman, Cliff" 07/07 9:16 AM >>> > Shane... > > I worked on the code last night and found a few things. The event > dispatcher looks at a passed message and is using a char array. It will blow > past all of the messages and never assign the event to the widget. This is > because the string is munged up with extra chars at the end. This is the > same problem with the menu items. Good news is that the messaging seems to > work as advertised. I hardcoded a clicked event into it and put a button on > the form. When I clicked it the message was passed back and the function > fired. As for control placement you will have to change the code to use > gtk_fixed_put the first time a widget is added to the fixed widget. After it > is in place you can then use move. I had to put that in the control last > night to get the controls to place correctly. > > Bad thing is that we have to rewrite some of the component code but because > of the way we designed it in the first place it should be pretty easy to do. > > > Cliff > > -----Original Message----- > From: Shane Miller > Sent: Wednesday, July 07, 1999 9:06 AM > To: > Subject: Re: [lazarus] Patches to Shanes files > > > All right, were back in business. I finally got the application to compile > again and bring up the menu. There was a problem with my "new" AddControl > procedure and I took way too long to figure it out. > > For today I'm going to clean up the code so it's somewhat presentable, and > test the new event's. If the events work correctly (please, please, please) > then I'll update CVS. > > Lazarus still has the problem with it's menu's having funny characters at > the end. I'm not sure why that is. I know the reason, but not the cause. > > Michael, I think you may be right about the interfraceobject being an > unneeded layer. I was thinking that once we had QT and GTK done it would be > great for a user to simply change a "define" and it would switch tools, but > if they know which tool they want to use, I guess they can specify a file to > link to. > > I'll see about cutting that file out. > Shane > > > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus >

Reply by email

P Jean dit Bailleul
to Shane Miller: I display the stringvar and it has NO garbage init before OR after the conversion, yet…
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.

Show quoted text 39 lines
Shane >>> "Michael A. Hess" 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. http://www.miraclec.com _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail 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 :
Web : Http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

Reply by email

Shane Miller

Another thought. Instead of calling InterfaceObject.Callback(some_string,self) should we be using something like LM_CLICKED and LM_SHOW? That way if the names for QT (or other tools) aren't the same as gtk's names the qt folks (when writing the interface) should be able to simply use the global variables to know what signal we are referring to.

This would make gtkint.pp have a few more lines i.e.

case Message of
  lm_show : signal := 'show';
  lm_hide : Signal := 'hide';
  lm_resize : Signal := 'size-allocate';
etc.

Shane

Reply by email

Cliff Baeseman

Shane I am going to work some more components while you smooth the upper you call it lower classes..... ;)

Cliff

Earlier message 138 lines
-----Original Message----- From: Shane Miller To: Date: Wednesday, July 07, 1999 3:38 PM Subject: Re: RE: [lazarus] Patches to Shanes files >I am using Strings but in Delphi they are really AnsiStrings. I guess I am assuming that they are AnsiStrings when declared as Strings. > >If StrAlloc remembers extra junk (which would be a bug) then how did you get around it? > >Shane > > >>>> "John Margaglione" 07/07 2:47 PM >>> >I was having the same problem a while ago. Are you using AnsiStrings? I >remember that PChar worked well with AnsiStrings, but that the StrAlloc >method would remember extra junk, no matter how I initialized the string >before copying. > >John > >----- Original Message ----- >From: Shane Miller >To: >Sent: Wednesday, July 07, 1999 12:50 PM >Subject: Re: RE: [lazarus] Patches to Shanes files > > >> 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. >> >> Please help.... >> >> Shane >> >> >> >>> "Baeseman, Cliff" 07/07 9:16 AM >>> >> Shane... >> >> I worked on the code last night and found a few things. The event >> dispatcher looks at a passed message and is using a char array. It will >blow >> past all of the messages and never assign the event to the widget. This is >> because the string is munged up with extra chars at the end. This is the >> same problem with the menu items. Good news is that the messaging seems to >> work as advertised. I hardcoded a clicked event into it and put a button >on >> the form. When I clicked it the message was passed back and the function >> fired. As for control placement you will have to change the code to use >> gtk_fixed_put the first time a widget is added to the fixed widget. After >it >> is in place you can then use move. I had to put that in the control last >> night to get the controls to place correctly. >> >> Bad thing is that we have to rewrite some of the component code but >because >> of the way we designed it in the first place it should be pretty easy to >do. >> >> >> Cliff >> >> -----Original Message----- >> From: Shane Miller >> Sent: Wednesday, July 07, 1999 9:06 AM >> To: >> Subject: Re: [lazarus] Patches to Shanes files >> >> >> All right, were back in business. I finally got the application to >compile >> again and bring up the menu. There was a problem with my "new" AddControl >> procedure and I took way too long to figure it out. >> >> For today I'm going to clean up the code so it's somewhat presentable, and >> test the new event's. If the events work correctly (please, please, >please) >> then I'll update CVS. >> >> Lazarus still has the problem with it's menu's having funny characters at >> the end. I'm not sure why that is. I know the reason, but not the cause. >> >> Michael, I think you may be right about the interfraceobject being an >> unneeded layer. I was thinking that once we had QT and GTK done it would >be >> great for a user to simply change a "define" and it would switch tools, >but >> if they know which tool they want to use, I guess they can specify a file >to >> link to. >> >> I'll see about cutting that file out. >> Shane >> >> >> >> _________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> >> _________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> >> _________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus >

Reply by email

Shane Miller

All right, were back in business. I finally got the application to compile again and bring up the menu. There was a problem with my "new" AddControl procedure and I took way too long to figure it out.

For today I'm going to clean up the code so it's somewhat presentable, and test the new event's. If the events work correctly (please, please, please) then I'll update CVS.

Lazarus still has the problem with it's menu's having funny characters at the end. I'm not sure why that is. I know the reason, but not the cause.

Michael, I think you may be right about the interfraceobject being an unneeded layer. I was thinking that once we had QT and GTK done it would be great for a user to simply change a "define" and it would switch tools, but if they know which tool they want to use, I guess they can specify a file to link to.

I'll see about cutting that file out.
Shane

Reply by email

Shane Miller

I can't change it to mode objpas because then I get all sorts of errors. I tried to use shortstrings but that didn't work.

I have uploaded the latest to ftp.miraclec.com/lazarus/newlaz.zip

Feel free to download it and look at this issue. It occurs in gtkint.pp's SETCALLBACKS.

Shane

>> "Shane Miller" 07/07 3:45 PM >>>

hmmm... I'm using {$mode objfpc}
I'll change it and see it that works.

Shane

>> Payne Thomas E CNIN 07/07 3:12 PM >>>

FYI

This works with 0.99.12a of win32
----------------------
program test;
{$mode objpas}
uses strings;
var
  newpchar : Pchar;
  stringvar : String;
begin
  stringvar := '>hello<';
  newpchar := StrAlloc(Length(StringVar)+1);
  StrPCopy(newPChar,StringVar);
  writeln(string(newpchar));
end.
----------------------
This does not
---------------------
program test;
{$mode delphi}
uses strings;
var
  newpchar : Pchar;
  stringvar : String;
begin
  stringvar := '>hello<';
  newpchar := StrAlloc(Length(StringVar)+1);
  StrPCopy(newPChar,StringVar);
  writeln(string(newpchar));
end.
---------------------

Tom

Show quoted text 30 lines
-----Original Message----- From: Shane Miller Sent: Wednesday, July 07, 1999 2:47 PM To: Subject: Re: [lazarus] Patches to Shanes files Another thought. Instead of calling InterfaceObject.Callback(some_string,self) should we be using something like LM_CLICKED and LM_SHOW? That way if the names for QT (or other tools) aren't the same as gtk's names the qt folks (when writing the interface) should be able to simply use the global variables to know what signal we are referring to. This would make gtkint.pp have a few more lines i.e. case Message of lm_show : signal := 'show'; lm_hide : Signal := 'hide'; lm_resize : Signal := 'size-allocate'; etc. Shane _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Shane Miller

I am using Strings but in Delphi they are really AnsiStrings. I guess I am assuming that they are AnsiStrings when declared as Strings.

If StrAlloc remembers extra junk (which would be a bug) then how did you get around it?

Shane

>> "John Margaglione" 07/07 2:47 PM >>>

I was having the same problem a while ago. Are you using AnsiStrings? I remember that PChar worked well with AnsiStrings, but that the StrAlloc method would remember extra junk, no matter how I initialized the string before copying.

John

Earlier message 103 lines
----- Original Message ----- From: Shane Miller To: Sent: Wednesday, July 07, 1999 12:50 PM Subject: Re: RE: [lazarus] Patches to Shanes files > 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. > > Please help.... > > Shane > > > >>> "Baeseman, Cliff" 07/07 9:16 AM >>> > Shane... > > I worked on the code last night and found a few things. The event > dispatcher looks at a passed message and is using a char array. It will blow > past all of the messages and never assign the event to the widget. This is > because the string is munged up with extra chars at the end. This is the > same problem with the menu items. Good news is that the messaging seems to > work as advertised. I hardcoded a clicked event into it and put a button on > the form. When I clicked it the message was passed back and the function > fired. As for control placement you will have to change the code to use > gtk_fixed_put the first time a widget is added to the fixed widget. After it > is in place you can then use move. I had to put that in the control last > night to get the controls to place correctly. > > Bad thing is that we have to rewrite some of the component code but because > of the way we designed it in the first place it should be pretty easy to do. > > > Cliff > > -----Original Message----- > From: Shane Miller > Sent: Wednesday, July 07, 1999 9:06 AM > To: > Subject: Re: [lazarus] Patches to Shanes files > > > All right, were back in business. I finally got the application to compile > again and bring up the menu. There was a problem with my "new" AddControl > procedure and I took way too long to figure it out. > > For today I'm going to clean up the code so it's somewhat presentable, and > test the new event's. If the events work correctly (please, please, please) > then I'll update CVS. > > Lazarus still has the problem with it's menu's having funny characters at > the end. I'm not sure why that is. I know the reason, but not the cause. > > Michael, I think you may be right about the interfraceobject being an > unneeded layer. I was thinking that once we had QT and GTK done it would be > great for a user to simply change a "define" and it would switch tools, but > if they know which tool they want to use, I guess they can specify a file to > link to. > > I'll see about cutting that file out. > Shane > > > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Shane Miller

OK, i am still having that problem so any help would be appreciated.

Michael, I have another thought for you. Tell me why this wouldn't be better. In SetCallback we are sent a signal name plus a Sender. We connect the signal to a procedure, depending on what signal is equal to, and we send it SENDER. All the procedure does is do a TControl(data).DispatchStr(signal). How about this. Instead of doing a

gtk_signal_connect(gobject,gsignal,gtk_signal_func(depends on what signal is), Sender)

we do this:
Procedure SetCallBack(Signal : String; Sender : TControl);
type
TMsg : record
  Name : String;
  Sender : TControl;
  end;
pMsg = ^TMsg;
Var
 Msg : pMsg;
Begin
Msg.Name := Signal;
Msg.Sender := Sender;

gtk_signal_connect(gobject,gsignal,gtk_signal_func(GlobalSignalFunction), Msg)

end;

Then we only have one procedure that does all the dispatching.

Procedure GlobalSugnalFunction(widget : pgtkWidget ; MSG : Pointer);
type
TMsg : record
  Name : String;
  Sender : TControl;
  end;
pMsg = ^TMsg;
Var
Sender : TControl;
Name : String;
begin
Name := pMsg(MSG)^.Name;
Sender:= pMsg(MSG)^.Sender;
TControl(Sender).DispatchStr(Name);
end;

Now we would have to probably still do a case statement in the SetCallBack to assign the signal to a different procedure if it requires different parameters, but most signals require the same thing.

Thoghts?

Shane

Reply by email

Unknown author
to Payne Thomas E CNIN: FYI This works with 0.99.12a of win32 ---------------------- program test; {$mode objpas}…
Payne Thomas E CNIN wrote 16 lines
FYI This works with 0.99.12a of win32 ---------------------- program test; {$mode objpas} uses strings; var newpchar : Pchar; stringvar : String; begin stringvar := '>hello<'; newpchar := StrAlloc(Length(StringVar)+1); StrPCopy(newPChar,StringVar); writeln(string(newpchar)); end.

This is Correct.
In objpas mode a pchar can be typecast to a shortstring.

Show quoted text 16 lines
---------------------- This does not --------------------- program test; {$mode delphi} uses strings; var newpchar : Pchar; stringvar : String; begin stringvar := '>hello<'; newpchar := StrAlloc(Length(StringVar)+1); StrPCopy(newPChar,StringVar); writeln(string(newpchar)); end.

In delphi mode, you can't typecast a pchar to a SHORTstring. You can, however, do it if you use the -Sh switch or {$H+} so the string is an ansistring. I that case the program works correctly.

For both cases:

1) The typecast isn't needed. You can directly write the value of the pchar.
2) NEVER use the 'strings' unit if you use ansistrings; the strings unit returns shortstrings only. If you do this, you get an additional conversion to ansistring.
Instead, use the 'sysutils' unit; it has the same routines as 'strings', only with ansistrings.

Michael.

Reply by email

Cliff Baeseman
I mean TApplication.Create;

oops...

Cliff

Earlier message 94 lines
-----Original Message----- From: Cliff Baeseman To: Date: Tuesday, July 06, 1999 10:25 PM Subject: Re: [lazarus] Patches to Shanes files >I got it to work under windows... I just had to make a call to >InterfaceObject.Init in TForm.Create(); > >Works slick.... > >Cliff > >-----Original Message----- >From: Cliff Baeseman >To: >Date: Tuesday, July 06, 1999 10:16 PM >Subject: Re: [lazarus] Patches to Shanes files > > >>Compiles on windows also after I commented the gtk_signal_destroy in >>gtkint.pp.. >> >>Does it do anything on your system. On windows it throws a ton of gtk >errors >>and unloads.. >> >>Cliff >>-----Original Message----- >>From: Michael A. Hess >>To: Lazarus-List >>Date: Tuesday, July 06, 1999 9:40 PM >>Subject: [lazarus] Patches to Shanes files >> >> >>>Greetings, >>> >>>OK Shane I patched the files so that they compile. You can get the files >>>patched at: >>> >>> ftp://ftp.miraclec.com/lazarus/lazarus_patch.zip >>> >>>I have to say that I think the InterfaceObject is extra overhead for not >>>much gain. If you will notice I edited the file to remove the >>>superfluous code. Those extra create and destroy didn't do anything so >>>there is no reason to have them. So this InterfaceObject doesn't really >>>get you anything over my GUIAPI object. The only difference is the use >>>of the #ifdef. This means that the interfaces.pp file will have to be >>>rewritten anytime someone wants to add a new API. If you wanted it so >>>that you could have a radio button in Lazarus IDE that would be >>>interesting but that means you will have to edit the Lazarus IDE >>>interface just to add a new API. With my version all you would have to >>>do is indicate a different location for the guiapi unit that you wanted >>>to link to. >>> >>>I realize it is 6 of one half a dozen of the other but I think it will >>>get more complicated having to add additional #ifdefs for each API. But >>>hey that is just my choice. >>> >>>What I added was the InitProcedure sequence so that when the method >>>application.initialization is called in lazarus.pp it calls the code to >>>start up gtk or whatever API the InitProcedure is pointing to. >>> >>>I also made InterfaceObjects a self creating unit. It creates and >>>distroys the InterfaceObjects object itself. So I remove the code from >>>TControl that did this. >>> >>>Enough for me tonight. It is just tooooo dang hot out here on the east >>>coast. 8-| >>> >>>-- >>>==== Programming my first best destiny! ==== >>> >>>Michael A. Hess Miracle Concepts, Inc. >>> http://www.miraclec.com >>> >>>_________________________________________________________________ >>> To unsubscribe: mail with >>> "unsubscribe" as the Subject >>> archives at http://www.miraclec.com/list_archives/lazarus >>> >> >>_________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus >

Reply by email

Shane Miller
I chagned all the SetCallBack functions to send a LM_MESSAGE instead of a string.  As I was in the middle of doing this I realized a problem.  The declaration of the methods use "message 'resize'" in them  So of course the next thought I had was why not use "message LM_RESIZE" and then we could use Dispatch(LM_RESIZE) instead of DispatchStr('resize');

I ask because I'm not that familiar with Dispatch. But I assume that's how it's meant to be used in the first place.

Shane

>> "Michael A. Hess" 07/07 3:12 PM >>>
Shane Miller wrote 7 lines
Another thought. Instead of calling InterfaceObject.Callback(some_string,self) should we be using something like LM_CLICKED and LM_SHOW? That way if the names for QT (or other tools) aren't the same as gtk's names the qt folks (when writing the interface) should be able to simply use the global variables to know what signal we are referring to.

Yep that is a real good one. Do it that way. :-)

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

John Margaglione
to Shane Miller: I am using Strings but in Delphi they are really AnsiStrings. I guess I am assuming that…

They are only ansistrings under FPC if you use the {$LONGSTRINGS} directive.

Earlier message 143 lines
----- Original Message ----- From: Shane Miller To: Sent: Wednesday, July 07, 1999 3:14 PM Subject: Re: RE: [lazarus] Patches to Shanes files > I am using Strings but in Delphi they are really AnsiStrings. I guess I am assuming that they are AnsiStrings when declared as Strings. > > If StrAlloc remembers extra junk (which would be a bug) then how did you get around it? > > Shane > > > >>> "John Margaglione" 07/07 2:47 PM >>> > I was having the same problem a while ago. Are you using AnsiStrings? I > remember that PChar worked well with AnsiStrings, but that the StrAlloc > method would remember extra junk, no matter how I initialized the string > before copying. > > John > > ----- Original Message ----- > From: Shane Miller > To: > Sent: Wednesday, July 07, 1999 12:50 PM > Subject: Re: RE: [lazarus] Patches to Shanes files > > > > 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. > > > > Please help.... > > > > Shane > > > > > > >>> "Baeseman, Cliff" 07/07 9:16 AM >>> > > Shane... > > > > I worked on the code last night and found a few things. The event > > dispatcher looks at a passed message and is using a char array. It will > blow > > past all of the messages and never assign the event to the widget. This is > > because the string is munged up with extra chars at the end. This is the > > same problem with the menu items. Good news is that the messaging seems to > > work as advertised. I hardcoded a clicked event into it and put a button > on > > the form. When I clicked it the message was passed back and the function > > fired. As for control placement you will have to change the code to use > > gtk_fixed_put the first time a widget is added to the fixed widget. After > it > > is in place you can then use move. I had to put that in the control last > > night to get the controls to place correctly. > > > > Bad thing is that we have to rewrite some of the component code but > because > > of the way we designed it in the first place it should be pretty easy to > do. > > > > > > Cliff > > > > -----Original Message----- > > From: Shane Miller > > Sent: Wednesday, July 07, 1999 9:06 AM > > To: > > Subject: Re: [lazarus] Patches to Shanes files > > > > > > All right, were back in business. I finally got the application to > compile > > again and bring up the menu. There was a problem with my "new" AddControl > > procedure and I took way too long to figure it out. > > > > For today I'm going to clean up the code so it's somewhat presentable, and > > test the new event's. If the events work correctly (please, please, > please) > > then I'll update CVS. > > > > Lazarus still has the problem with it's menu's having funny characters at > > the end. I'm not sure why that is. I know the reason, but not the cause. > > > > Michael, I think you may be right about the interfraceobject being an > > unneeded layer. I was thinking that once we had QT and GTK done it would > be > > great for a user to simply change a "define" and it would switch tools, > but > > if they know which tool they want to use, I guess they can specify a file > to > > link to. > > > > I'll see about cutting that file out. > > Shane > > > > > > > > _________________________________________________________________ > > To unsubscribe: mail with > > "unsubscribe" as the Subject > > archives at http://www.miraclec.com/list_archives/lazarus > > > > _________________________________________________________________ > > To unsubscribe: mail with > > "unsubscribe" as the Subject > > archives at http://www.miraclec.com/list_archives/lazarus > > > > _________________________________________________________________ > > To unsubscribe: mail with > > "unsubscribe" as the Subject > > archives at http://www.miraclec.com/list_archives/lazarus > > > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >

Reply by email

Michael A. Hess
to Payne Thomas E CNIN: FYI This works with 0.99.12a of win32 ---------------------- program test; {$mode objpas}…
Payne Thomas E CNIN wrote 34 lines
FYI This works with 0.99.12a of win32 ---------------------- program test; {$mode objpas} uses strings; var newpchar : Pchar; stringvar : String; begin stringvar := '>hello<'; newpchar := StrAlloc(Length(StringVar)+1); StrPCopy(newPChar,StringVar); writeln(string(newpchar)); end. ---------------------- This does not --------------------- program test; {$mode delphi} uses strings; var newpchar : Pchar; stringvar : String; begin stringvar := '>hello<'; newpchar := StrAlloc(Length(StringVar)+1); StrPCopy(newPChar,StringVar); writeln(string(newpchar)); end. ---------------------

Interesting. That being the case Shane, declare the variable that you are sending as a short string and then pass that.

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Peter Vreman
to John Margaglione: I was having the same problem a while ago. Are you using AnsiStrings? I remember that…
I was having the same problem a while ago. Are you using AnsiStrings? I remember that PChar worked well with AnsiStrings, but that the StrAlloc method would remember extra junk, no matter how I initialized the string before copying.

Please give a complete example then i'll take a

Show quoted text 107 lines
John ----- Original Message ----- From: Shane Miller To: Sent: Wednesday, July 07, 1999 12:50 PM Subject: Re: RE: [lazarus] Patches to Shanes files > 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. > > Please help.... > > Shane > > > >>> "Baeseman, Cliff" 07/07 9:16 AM >>> > Shane... > > I worked on the code last night and found a few things. The event > dispatcher looks at a passed message and is using a char array. It will blow > past all of the messages and never assign the event to the widget. This is > because the string is munged up with extra chars at the end. This is the > same problem with the menu items. Good news is that the messaging seems to > work as advertised. I hardcoded a clicked event into it and put a button on > the form. When I clicked it the message was passed back and the function > fired. As for control placement you will have to change the code to use > gtk_fixed_put the first time a widget is added to the fixed widget. After it > is in place you can then use move. I had to put that in the control last > night to get the controls to place correctly. > > Bad thing is that we have to rewrite some of the component code but because > of the way we designed it in the first place it should be pretty easy to do. > > > Cliff > > -----Original Message----- > From: Shane Miller > Sent: Wednesday, July 07, 1999 9:06 AM > To: > Subject: Re: [lazarus] Patches to Shanes files > > > All right, were back in business. I finally got the application to compile > again and bring up the menu. There was a problem with my "new" AddControl > procedure and I took way too long to figure it out. > > For today I'm going to clean up the code so it's somewhat presentable, and > test the new event's. If the events work correctly (please, please, please) > then I'll update CVS. > > Lazarus still has the problem with it's menu's having funny characters at > the end. I'm not sure why that is. I know the reason, but not the cause. > > Michael, I think you may be right about the interfraceobject being an > unneeded layer. I was thinking that once we had QT and GTK done it would be > great for a user to simply change a "define" and it would switch tools, but > if they know which tool they want to use, I guess they can specify a file to > link to. > > I'll see about cutting that file out. > Shane > > > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael A. Hess
to Shane Miller: OK, i am still having that problem so any help would be appreciated. Michael, I have…
Shane Miller wrote
OK, i am still having that problem so any help would be appreciated.

I'll start to look at it.

Tell me why this wouldn't be better.
Show quoted text 15 lines
TMsg : record Name : String; Sender : TControl; end; pMsg = ^TMsg; Var Msg : pMsg; Begin Msg.Name := Signal; Msg.Sender := Sender; gtk_signal_connect(gobject,gsignal,gtk_signal_func(GlobalSignalFunction), Msg)

No this won't work. I thought about this when I was doing it ans it would be nice but no.

The information that is being passed to the gti_signal_connect in the Msg variable is a pointer. Not the actual information but a pointer TO the information.

If you wanted to pass a pointer to a record as shown above, then you would have to alloc memory for each one of those separately for every signal that you are sending. The problem is that you need to free that memory at a later time. However, we don't have a connection between a signal that needs to be destroyed and the message pointer so we can't tell which one that was created that needs to be freed.

So basically no we can't do it this way.

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Baeseman, Cliff

Shane...

I worked on the code last night and found a few things. The event dispatcher looks at a passed message and is using a char array. It will blow past all of the messages and never assign the event to the widget. This is because the string is munged up with extra chars at the end. This is the same problem with the menu items. Good news is that the messaging seems to work as advertised. I hardcoded a clicked event into it and put a button on the form. When I clicked it the message was passed back and the function fired. As for control placement you will have to change the code to use gtk_fixed_put the first time a widget is added to the fixed widget. After it is in place you can then use move. I had to put that in the control last night to get the controls to place correctly.

Bad thing is that we have to rewrite some of the component code but because of the way we designed it in the first place it should be pretty easy to do.

Cliff

Earlier message 33 lines
-----Original Message----- From: Shane Miller Sent: Wednesday, July 07, 1999 9:06 AM To: Subject: Re: [lazarus] Patches to Shanes files All right, were back in business. I finally got the application to compile again and bring up the menu. There was a problem with my "new" AddControl procedure and I took way too long to figure it out. For today I'm going to clean up the code so it's somewhat presentable, and test the new event's. If the events work correctly (please, please, please) then I'll update CVS. Lazarus still has the problem with it's menu's having funny characters at the end. I'm not sure why that is. I know the reason, but not the cause. Michael, I think you may be right about the interfraceobject being an unneeded layer. I was thinking that once we had QT and GTK done it would be great for a user to simply change a "define" and it would switch tools, but if they know which tool they want to use, I guess they can specify a file to link to. I'll see about cutting that file out. Shane _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael A. Hess
to Shane Miller: I have fixed the problem with the events using a char array (sort of) by changing it to a…
Shane Miller wrote 11 lines
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. http://www.miraclec.com

Reply by email

Shane Miller

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.

Please help....

Shane

>> "Baeseman, Cliff" 07/07 9:16 AM >>>

Shane...

I worked on the code last night and found a few things. The event dispatcher looks at a passed message and is using a char array. It will blow past all of the messages and never assign the event to the widget. This is because the string is munged up with extra chars at the end. This is the same problem with the menu items. Good news is that the messaging seems to work as advertised. I hardcoded a clicked event into it and put a button on the form. When I clicked it the message was passed back and the function fired. As for control placement you will have to change the code to use gtk_fixed_put the first time a widget is added to the fixed widget. After it is in place you can then use move. I had to put that in the control last night to get the controls to place correctly.

Bad thing is that we have to rewrite some of the component code but because of the way we designed it in the first place it should be pretty easy to do.

Cliff

Earlier message 38 lines
-----Original Message----- From: Shane Miller Sent: Wednesday, July 07, 1999 9:06 AM To: Subject: Re: [lazarus] Patches to Shanes files All right, were back in business. I finally got the application to compile again and bring up the menu. There was a problem with my "new" AddControl procedure and I took way too long to figure it out. For today I'm going to clean up the code so it's somewhat presentable, and test the new event's. If the events work correctly (please, please, please) then I'll update CVS. Lazarus still has the problem with it's menu's having funny characters at the end. I'm not sure why that is. I know the reason, but not the cause. Michael, I think you may be right about the interfraceobject being an unneeded layer. I was thinking that once we had QT and GTK done it would be great for a user to simply change a "define" and it would switch tools, but if they know which tool they want to use, I guess they can specify a file to link to. I'll see about cutting that file out. Shane _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael A. Hess
to Shane Miller: Another thought. Instead of calling InterfaceObject.Callback(some_string,self) should we…
Shane Miller wrote 7 lines
Another thought. Instead of calling InterfaceObject.Callback(some_string,self) should we be using something like LM_CLICKED and LM_SHOW? That way if the names for QT (or other tools) aren't the same as gtk's names the qt folks (when writing the interface) should be able to simply use the global variables to know what signal we are referring to.

Yep that is a real good one. Do it that way. :-)

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Shane Miller

hmmm... I'm using {$mode objfpc}
I'll change it and see it that works.

Shane

>> Payne Thomas E CNIN 07/07 3:12 PM >>>

FYI

This works with 0.99.12a of win32
----------------------
program test;
{$mode objpas}
uses strings;
var
  newpchar : Pchar;
  stringvar : String;
begin
  stringvar := '>hello<';
  newpchar := StrAlloc(Length(StringVar)+1);
  StrPCopy(newPChar,StringVar);
  writeln(string(newpchar));
end.
----------------------
This does not
---------------------
program test;
{$mode delphi}
uses strings;
var
  newpchar : Pchar;
  stringvar : String;
begin
  stringvar := '>hello<';
  newpchar := StrAlloc(Length(StringVar)+1);
  StrPCopy(newPChar,StringVar);
  writeln(string(newpchar));
end.
---------------------

Tom

Show quoted text 30 lines
-----Original Message----- From: Shane Miller Sent: Wednesday, July 07, 1999 2:47 PM To: Subject: Re: [lazarus] Patches to Shanes files Another thought. Instead of calling InterfaceObject.Callback(some_string,self) should we be using something like LM_CLICKED and LM_SHOW? That way if the names for QT (or other tools) aren't the same as gtk's names the qt folks (when writing the interface) should be able to simply use the global variables to know what signal we are referring to. This would make gtkint.pp have a few more lines i.e. case Message of lm_show : signal := 'show'; lm_hide : Signal := 'hide'; lm_resize : Signal := 'size-allocate'; etc. Shane _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael A. Hess
to Shane Miller: I chagned all the SetCallBack functions to send a LM_MESSAGE instead of a string. As I…
Shane Miller wrote 10 lines
I chagned all the SetCallBack functions to send a LM_MESSAGE instead of a string. As I was in the middle of doing this I realized a problem. The declaration of the methods use "message 'resize'" in them So of course the next thought I had was why not use "message LM_RESIZE" and then we could use Dispatch(LM_RESIZE) instead of DispatchStr('resize'); I ask because I'm not that familiar with Dispatch. But I assume that's how it's meant to be used in the first place.

As long as you use the same value in the procedure declaration, ie.

procedure DoClick(var msg); message LM_CLICK;
Then you can do DispatchStr(LM_CLICK);

When you define the message with the procedure it creates a table that contains the string that is indicated. In this case it is whatever LM_CLICK would be set to.

Then when you call DispatchStr(LM_CLICK) it is taking the value being given it in the case LM_CLICK and scanning through the table until it finds a match and then calls the pointer that was set in the table to match that string. It can be whatever we want. It can be numbers '123' just so long as it is a distinct string value.

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Shane Miller

I display the stringvar and it has NO garbage init before OR after the conversion, yet the newpchar does.

Shane

>> "Michael A. Hess" 07/07 1:09 PM >>>
Shane Miller wrote 11 lines
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. http://www.miraclec.com _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael A. Hess
to P Jean dit Bailleul: Well perhaps a solution which is not the best one but... newpchar :=…
P Jean dit Bailleul wrote 5 lines
If this work but not the StrPCopy, there some bug in the StrPCopy implementation since it should be the same in both. an other try you could is add a null (#0) char at the end of the string, then do the StrPCopy

That was exactly our point. The problem is when we try to make a simple sample program, StrPCopy works correctly. So this means that something else is stomping on memory someplace and StrPCopy just happens to be what gets affected. :-\

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Shane Miller

That's a seperate error. The error you are referring to is during the compile. The ExceptionAddressStack error is while it's running.

Shane

>> "Baeseman, Cliff" 07/08 12:19 PM >>>

I get the same problems on win32 and my linux box. Try doing a compile again and it works?

I let the compiler throw the error and just compile again. On the second pass it will work.

Have you gotten the interface to show yet?. I am not having the menu bar problem at home..

Cliff

Earlier message 92 lines
-----Original Message----- From: Michael A. Hess Sent: Thursday, July 08, 1999 12:03 PM To: Subject: Re: [lazarus] Patches to Shanes files Shane Miller wrote: > > Notice in gtkint.pp I had commented out all the strdispose functions. > That's not good. :-) I had noticed that and put them back in why I was testing. :-) > Once I put those back in (for every StrPCopy there should be one) Not for every StrPCopy but for every StrAlloc. > then the strpcopy seemed to work fine. I think that is a fluke. I was trying to use the StrPCopy against gsignal : array[0..20] of char; which would mean it was dynamically allocated on the stack each time the method was called and StrPCopy still goofed it up. > 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? I am beginning to think that it is something nasty that is going on else where but I can't point to a specific thing. Here is the reason I am suspecting it. For one, because of some of the issues and test we are doing and second because of something that occured for me when I was tracing the Exception last night. I was putting some simple writeln('xxx'); statements in the code so as to determine where things were and to figure out where the exceptions was coming from. At one point I placed a writeln in the code and suddenly the compiler complained that a class was suddenly defined wrong. In TApplication we pass in a reference to a TFormClass which is simply type TFormClass : class of TForm; It actually looks like this TApplication.CreateForm(Form : TFormClass; var ref); I think that is correct I'm doing it from memory. Then in the lazarus.pp unit it is called with. Application.CreateForm(TForm1, Form1); Now TForm1 is simply type TForm1 : class (TForm) but when I put the writeln statement in I was talking about the compiler suddenly complains that it was expecting TFormClass to be passed and it got TForm1 instead. But they are the same thing??????? I removed the writeln and it compile correctly. I put it back and it complained. I moved the writeln up on the other side of a few commented lines and it compile correctly. So something is going goofy during the compile. I don't know if this is part of the StrPCopy problem but it is strange. :-\ -- ==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael A. Hess
to P Jean dit Bailleul: Well perhaps a solution which is not the best one but... newpchar :=…
P Jean dit Bailleul wrote 9 lines
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!

Oh we did that one last night. It worked correctly for the StrPCopy but then we get an exception out of a gtk routine. It solved it but doesn't explain what is the root of the problem.

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Curtis White
to Shane Miller: I did a writeln('Length of signal is '+Inttostr(Length(Signal))); and that came out…

It almost looks like you are using AnsiStrings. That would explain why your second way showed a blank for the length. You can't read the length of an AnsiString that way. Do you have {$H} defined at the top of the unit? If so, then I you are probably using AnsiStrings.

I just had a similar problem working with the Simple IDE. There are a lot of calls to gtk methods and many of them pass strings as parameters (actually pgchar which gets passed as 'a string'). When I added {$H} to the top of the unit to use AnsiStrings, so I could do a PChar(workStr), I got all kinds of errors. When I removed the {$H}, the errors went away and it works fine. Apparently you can pass a ShortString in place of a pgchar but not an AnsiString.

This may not be related at all to the problem you are having or you may have already looked at this, but I just had the problem and thought I would put it out there just in case it might help.

Thanks...Curtis

On 08-Jul-99 Shane Miller wrote 142 lines
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 Not sure how else to look at it.... Shane >>> P Jean dit Bailleul 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 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" 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. >> http://www.miraclec.com >> >>_________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> >>_________________________________________________________________ >> To unsubscribe: mail 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 : >Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp >Tel : +1 (819) 565 9174 poste 251 >Fax : +1 (819) 564 5507 > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail 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 : Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251 Fax : +1 (819) 564 5507 _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

----------------------------------
Curtis White
Curtis White
http://www.teleport.com/~osiriz/
----------------------------------

Reply by email

Shane Miller

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

Not sure how else to look at it....

Shane

>> P Jean dit Bailleul 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.

you wrote 14 lines
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.

Show quoted text 80 lines
Shane end; >>> P Jean dit Bailleul 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" 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. > http://www.miraclec.com > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail 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 : Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251 Fax : +1 (819) 564 5507 _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail 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 :
Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Baeseman, Cliff

I get the same problems on win32 and my linux box. Try doing a compile again and it works?

I let the compiler throw the error and just compile again. On the second pass it will work.

Have you gotten the interface to show yet?. I am not having the menu bar problem at home..

Cliff

Earlier message 87 lines
-----Original Message----- From: Michael A. Hess Sent: Thursday, July 08, 1999 12:03 PM To: Subject: Re: [lazarus] Patches to Shanes files Shane Miller wrote: > > Notice in gtkint.pp I had commented out all the strdispose functions. > That's not good. :-) I had noticed that and put them back in why I was testing. :-) > Once I put those back in (for every StrPCopy there should be one) Not for every StrPCopy but for every StrAlloc. > then the strpcopy seemed to work fine. I think that is a fluke. I was trying to use the StrPCopy against gsignal : array[0..20] of char; which would mean it was dynamically allocated on the stack each time the method was called and StrPCopy still goofed it up. > 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? I am beginning to think that it is something nasty that is going on else where but I can't point to a specific thing. Here is the reason I am suspecting it. For one, because of some of the issues and test we are doing and second because of something that occured for me when I was tracing the Exception last night. I was putting some simple writeln('xxx'); statements in the code so as to determine where things were and to figure out where the exceptions was coming from. At one point I placed a writeln in the code and suddenly the compiler complained that a class was suddenly defined wrong. In TApplication we pass in a reference to a TFormClass which is simply type TFormClass : class of TForm; It actually looks like this TApplication.CreateForm(Form : TFormClass; var ref); I think that is correct I'm doing it from memory. Then in the lazarus.pp unit it is called with. Application.CreateForm(TForm1, Form1); Now TForm1 is simply type TForm1 : class (TForm) but when I put the writeln statement in I was talking about the compiler suddenly complains that it was expecting TFormClass to be passed and it got TForm1 instead. But they are the same thing??????? I removed the writeln and it compile correctly. I put it back and it complained. I moved the writeln up on the other side of a few commented lines and it compile correctly. So something is going goofy during the compile. I don't know if this is part of the StrPCopy problem but it is strange. :-\ -- ==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael Van Canneyt
to Shane Miller: I did a writeln('Length of signal is '+Inttostr(Length(Signal))); and that came out…
Shane Miller wrote 8 lines
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

??? You should do a

  writeln ('Length of signal is : ',Ord(Signal[0]));

You won't see a control character on the screen on linux. the above will print the length as a readable number. Mind you, it won't work with ansistrings, there S[0] is not available (the compiler will give an error)

Michael.

Show quoted text 135 lines
Not sure how else to look at it.... Shane >>> P Jean dit Bailleul 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 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" 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. >> http://www.miraclec.com >> >>_________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> >>_________________________________________________________________ >> To unsubscribe: mail 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 : >Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp >Tel : +1 (819) 565 9174 poste 251 >Fax : +1 (819) 564 5507 > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail 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 : Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251 Fax : +1 (819) 564 5507 _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael A. Hess
to Shane Miller: OK, here's the scoop. Notice in gtkint.pp I had commented out all the strdispose…
Shane Miller wrote
Notice in gtkint.pp I had commented out all the strdispose functions. That's not good. :-)

I had noticed that and put them back in why I was testing. :-)

Once I put those back in (for every StrPCopy there should be one)

Not for every StrPCopy but for every StrAlloc.

then the strpcopy seemed to work fine.

I think that is a fluke. I was trying to use the StrPCopy against

gsignal : array[0..20] of char;

which would mean it was dynamically allocated on the stack each time the method was called and StrPCopy still goofed it up.

Show quoted text 7 lines
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?

I am beginning to think that it is something nasty that is going on else where but I can't point to a specific thing. Here is the reason I am suspecting it. For one, because of some of the issues and test we are doing and second because of something that occured for me when I was tracing the Exception last night. I was putting some simple writeln('xxx'); statements in the code so as to determine where things were and to figure out where the exceptions was coming from. At one point I placed a writeln in the code and suddenly the compiler complained that a class was suddenly defined wrong.

In TApplication we pass in a reference to a TFormClass which is simply

type
   TFormClass : class of TForm;

It actually looks like this

TApplication.CreateForm(Form : TFormClass; var ref);

I think that is correct I'm doing it from memory.

Then in the lazarus.pp unit it is called with.

Application.CreateForm(TForm1, Form1);

Now TForm1 is simply

type
    TForm1 : class (TForm)

but when I put the writeln statement in I was talking about the compiler suddenly complains that it was expecting TFormClass to be passed and it got TForm1 instead.

But they are the same thing???????

I removed the writeln and it compile correctly. I put it back and it complained. I moved the writeln up on the other side of a few commented lines and it compile correctly. So something is going goofy during the compile. I don't know if this is part of the StrPCopy problem but it is strange. :-\

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Peter Vreman
to Michael A. Hess: I should have waited a few minutes before sending my last email. ;-) I'll give a look…
Show quoted text 5 lines
> I have uploaded the latest to ftp.miraclec.com/lazarus/newlaz.zip I should have waited a few minutes before sending my last email. ;-) I'll give a look see but first I need to go get some grub. 8-|

Why don't you use CVS and create an expirimental branch. If the branch is stable again then you do a merge to the main branch.

Peter

Reply by email

Shane Miller

hmmm...I was wrong. The strPCopoy still doesn't work.

Shane

>> "Shane Miller" 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 07/08 10:25 AM >>>
you wrote 8 lines
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

Show quoted text 135 lines
Not sure how else to look at it.... Shane >>> P Jean dit Bailleul 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 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" 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. >> http://www.miraclec.com >> >>_________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> >>_________________________________________________________________ >> To unsubscribe: mail 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 : >Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp >Tel : +1 (819) 565 9174 poste 251 >Fax : +1 (819) 564 5507 > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail 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 : Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251 Fax : +1 (819) 564 5507 _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail 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 :
Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

P Jean dit Bailleul
to Shane Miller: Didn't work. I do this now. procedure TCustomForm.Create(aowner : TComponent); begin stuff

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.

you wrote 14 lines
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.

Show quoted text 80 lines
Shane end; >>> P Jean dit Bailleul 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" 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. > http://www.miraclec.com > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail 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 : Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251 Fax : +1 (819) 564 5507 _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail 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 :
Web : Http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

Reply by email

Michael A. Hess
to Curtis White: It almost looks like you are using AnsiStrings. That would explain why your second way…
Curtis White wrote
This may not be related at all to the problem you are having or you may have already looked at this, but I just had the problem and thought I would put it out there just in case it might help.

I think it might be related but I don't think the fix is that simple. I tried different modes; {$mode objfpc}, {$mode delphi}, along with {$H+} and {$H-} in various combinations and it keep giving the same error. Unless I happened to miss a combination. :-)

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

P Jean dit Bailleul
to Shane Miller: hmmm...I was wrong. The strPCopoy still doesn't work. Shane OK, here's the scoop. Notice…

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!

you wrote 8 lines
hmmm...I was wrong. The strPCopoy still doesn't work. Shane >>> "Shane Miller" 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.

Show quoted text 186 lines
Any thoughts now? Shane >>> P Jean dit Bailleul 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 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 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" 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. >>> http://www.miraclec.com >>> >>>_________________________________________________________________ >>> To unsubscribe: mail with >>> "unsubscribe" as the Subject >>> archives at http://www.miraclec.com/list_archives/lazarus >>> >>>_________________________________________________________________ >>> To unsubscribe: mail 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 : >>Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp >>Tel : +1 (819) 565 9174 poste 251 >>Fax : +1 (819) 564 5507 >> >>_________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> >>_________________________________________________________________ >> To unsubscribe: mail 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 : >Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp >Tel : +1 (819) 565 9174 poste 251 >Fax : +1 (819) 564 5507 > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail 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 : Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251 Fax : +1 (819) 564 5507 _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail 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 :
Web : Http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

Reply by email

Shane Miller

Yes, we thoguht of that and tried it. It does work, but then when trying to gtk_widget_show the menubar we get At end of ExceptionAddressStack
and it crashes.

I'm not sure how they are related, but that's what happens.

Shane

>> P Jean dit Bailleul 07/08 11:42 AM >>>

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!

you wrote 8 lines
hmmm...I was wrong. The strPCopoy still doesn't work. Shane >>> "Shane Miller" 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.

Show quoted text 186 lines
Any thoughts now? Shane >>> P Jean dit Bailleul 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 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 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" 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. >>> http://www.miraclec.com >>> >>>_________________________________________________________________ >>> To unsubscribe: mail with >>> "unsubscribe" as the Subject >>> archives at http://www.miraclec.com/list_archives/lazarus >>> >>>_________________________________________________________________ >>> To unsubscribe: mail 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 : >>Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp >>Tel : +1 (819) 565 9174 poste 251 >>Fax : +1 (819) 564 5507 >> >>_________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> >>_________________________________________________________________ >> To unsubscribe: mail 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 : >Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp >Tel : +1 (819) 565 9174 poste 251 >Fax : +1 (819) 564 5507 > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail 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 : Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251 Fax : +1 (819) 564 5507 _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail 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 :
Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

P Jean dit Bailleul
to P Jean dit Bailleul: Well perhaps a solution which is not the best one but... newpchar :=…
you wrote 14 lines
P Jean dit Bailleul wrote: > > 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! Oh we did that one last night. It worked correctly for the StrPCopy but then we get an exception out of a gtk routine. It solved it but doesn't explain what is the root of the problem.

If this work but not the StrPCopy, there some bug in the StrPCopy implementation since it should be the same in both. an other try you could is add a null (#0) char at the end of the string, then do the StrPCopy

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 :
Web : Http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

Reply by email

Shane Miller

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 07/08 10:25 AM >>>
you wrote 8 lines
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

Show quoted text 135 lines
Not sure how else to look at it.... Shane >>> P Jean dit Bailleul 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 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" 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. >> http://www.miraclec.com >> >>_________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> >>_________________________________________________________________ >> To unsubscribe: mail 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 : >Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp >Tel : +1 (819) 565 9174 poste 251 >Fax : +1 (819) 564 5507 > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail 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 : Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251 Fax : +1 (819) 564 5507 _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail 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 :
Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

P Jean dit Bailleul
to Shane Miller: I did a writeln('Length of signal is '+Inttostr(Length(Signal))); and that came out…
you wrote 8 lines
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

Show quoted text 135 lines
Not sure how else to look at it.... Shane >>> P Jean dit Bailleul 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 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" 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. >> http://www.miraclec.com >> >>_________________________________________________________________ >> To unsubscribe: mail with >> "unsubscribe" as the Subject >> archives at http://www.miraclec.com/list_archives/lazarus >> >>_________________________________________________________________ >> To unsubscribe: mail 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 : >Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp >Tel : +1 (819) 565 9174 poste 251 >Fax : +1 (819) 564 5507 > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus > >_________________________________________________________________ > To unsubscribe: mail 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 : Web : http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251 Fax : +1 (819) 564 5507 _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail 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 :
Web : Http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

Reply by email

P Jean dit Bailleul
to P Jean dit Bailleul: Well perhaps a solution which is not the best one but... newpchar :=…
you wrote 11 lines
P Jean dit Bailleul wrote: > > If this work but not the StrPCopy, there some bug in the StrPCopy > implementation since it should be the same in both. an other try you > could is add a null (#0) char at the end of the string, then do the > StrPCopy That was exactly our point. The problem is when we try to make a simple sample program, StrPCopy works correctly. So this means that something else is stomping on memory someplace and StrPCopy just happens to be what gets affected. :-\

StrPCopy should use the length of the String variable and not until an #0 is found since it convert from String to Array of Char (PChar). But the length of the variable is correct (previous tests). If adding an #0 to the end of the string variable solve the problem it mean that StrPCopy is not implemented the way it should be. If it does not solve the problem, the memory gets corrupted from some where else during the call to corrupt the data. An other problem can that the program is corrupted in memory by a wrong acces (is it possible under Linux?, I'm too beginner to know this :-(

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 :
Web : Http://res.agr.ca/swinenet/porcexpert/jeanditbailleulp Tel : +1 (819) 565 9174 poste 251
Fax : +1 (819) 564 5507

Reply by email