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

Mailing lists / lazarus / 1999-07
49 messages · 11 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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
Cliff Baeseman wroteCompiles 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. :-)
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-|
I got it to work under windows... I just had to make a call to
InterfaceObject.Init in TForm.Create();Works slick....
Cliff
I'm using sysutils in gtkint.pp not strings.
Shane
>> 07/07 3:54 PM >>>
This is Correct.
In objpas mode a pchar can be typecast to a shortstring.
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
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
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 wroteI 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.
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
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
I display the stringvar and it has NO garbage init before OR after the conversion, yet…
you wroteI 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.
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
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
Shane I am going to work some more components while you smooth the upper you call it lower classes..... ;)
Cliff
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
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
_________________________________________________________________ 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
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
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
FYI This works with 0.99.12a of win32 ---------------------- program test; {$mode objpas}…
This is Correct.
In objpas mode a pchar can be typecast to a shortstring.
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.
I mean TApplication.Create;oops...
Cliff
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 >>>
Yep that is a real good one. Do it that way. :-)
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.
FYI This works with 0.99.12a of win32 ---------------------- program test; {$mode objpas}…
Interesting. That being the case Shane, declare the variable that you are sending as a short string and then pass that.
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
OK, i am still having that problem so any help would be appreciated. Michael, I have…
Shane Miller wroteOK, 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.
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.
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
I have fixed the problem with the events using a char array (sort of) by changing it to a…
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.
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
Another thought. Instead of calling InterfaceObject.Callback(some_string,self) should we…
Yep that is a real good one. Do it that way. :-)
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
_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus
I chagned all the SetCallBack functions to send a LM_MESSAGE instead of a string. As I…
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.
hmmm... I'm using {$mode objfpc} I'll change it and see it that works. Shane FYI This…
hmmm... I'm using {$mode objfpc} I'll change it and see it that works.
the mode doesn't matter for ansistrings in your own unit/program. Only the $H+ and H- switch and -Sh commandline option.
Peter
I can't change it to mode objpas because then I get all sorts of errors. I tried to use…
Shane Miller wroteI 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-|
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 >>>
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.
Well perhaps a solution which is not the best one but... newpchar :=…
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. :-\
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
Well perhaps a solution which is not the best one but... newpchar :=…
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.
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
----------------------------------
Curtis White
Curtis White
http://www.teleport.com/~osiriz/
----------------------------------
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.
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.
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
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
I did a writeln('Length of signal is '+Inttostr(Length(Signal))); and that came out…
??? 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.
OK, here's the scoop. Notice in gtkint.pp I had commented out all the strdispose…
Shane Miller wroteNotice 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.
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. :-\
I should have waited a few minutes before sending my last email. ;-) I'll give a look…
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
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 >>>
try in the debugger to see the Signal[0]. if the length is 10, then it *should* be #10
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
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.
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.
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
It almost looks like you are using AnsiStrings. That would explain why your second way…
Curtis White wroteThis 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. :-)
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!
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.
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
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!
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.
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
Well perhaps a solution which is not the best one but... newpchar :=…
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
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 >>>
try in the debugger to see the Signal[0]. if the length is 10, then it *should* be #10
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
I did a writeln('Length of signal is '+Inttostr(Length(Signal))); and that came out…
try in the debugger to see the Signal[0]. if the length is 10, then it *should* be #10
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
Well perhaps a solution which is not the best one but... newpchar :=…
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