Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 10th, 2004, 11:27 AM
Mortamer Mortamer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 36 Mortamer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 46 sec
Reputation Power: 5
[Pascal Error] Unit1.pas(1): Unable to invoke Code Completion due to errors in source

Ok, I can call a ListBox in some procedures but not others. For example, in FormCreate I can call it, but in another procedure I get ""[Pascal Error] Unit1.pas(1): Unable to invoke Code Completion due to errors in source code". Does that error mean I can't call it or it just wont give me code completion? and why is it happening?

Reply With Quote
  #2  
Old July 15th, 2004, 05:23 AM
PaulGer PaulGer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Hamburg, DE
Posts: 68 PaulGer User rank is Corporal (100 - 500 Reputation Level)PaulGer User rank is Corporal (100 - 500 Reputation Level)PaulGer User rank is Corporal (100 - 500 Reputation Level)PaulGer User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 18 h 52 m 11 sec
Reputation Power: 9
You do know that the other members here aren't psychic, right?

Post your source so we can see what the problem is

Reply With Quote
  #3  
Old July 20th, 2004, 02:57 PM
Mortamer Mortamer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 36 Mortamer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 46 sec
Reputation Power: 5
example:
Code:
unit Unit1;

interface

uses
	Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
	Dialogs, StdCtrls;

type
	TForm1 = class(TForm)
		Button1: TButton;
		lbIEURL: TListBox;
		procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
	public
		{ Public declarations }
	end;

var
	Form1: TForm1;

implementation

{$R *.dfm}

procedure clear();
begin
lbIEURL.clear; // error
end;

function GetUrlFromIE (Handle: THandle; List: TStringList): boolean; stdcall;
var
	hWndIE, hWndIEChild : HWND;
	Buffer : array[0..255] of Char;
begin
	//get the window caption
	SendMessage(Handle, WM_GETTEXT, 255, integer(@Buffer[0]));
	//look for the Internet Explorer window with "Buffer" caption
	hWndIE := FindWindow('IEFrame', Buffer);
	if hWndIE > 0 then
begin
		//try to get a handle to IE's toolbar container
		hWndIEChild := FindWindowEx(hWndIE, 0, 'WorkerW', nil);
		if hWndIEChild > 0 then
		begin
			//get a handle to address bar
			hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil);
			if hWndIEChild > 0 then
			begin
				//finally, locate combo box and add its text to the list
				hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil);
				if hWndIEChild > 0 then
				begin
					SendMessage(hWndIEChild, WM_GETTEXT, 255, integer(@Buffer));
					//List.AddObject(Buffer,TObject(hWndIE));
					List.Add(Buffer)
				end;
			end;
		end;
	end;
	//continue enumeration
	Result :=True;
end; (*GetUrlFromIE*)

procedure TForm1.Button1Click(Sender: TObject);
begin
 clear();  //if I put lbIEURL.clear here, it'd work
 EnumWindows(@GetUrlFromIE, LParam(lbIEURL.Items));
end;

end.

and the error
Code:
[Error] Unit1.pas(29): Undeclared identifier: 'lbIEURL'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'

Reply With Quote
  #4  
Old July 20th, 2004, 04:16 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Click here for more information.
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,713 Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 11 h 21 m 11 sec
Reputation Power: 1179
Well, clear() is not a method of TForm1, so it can't access any of its components.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month

Reply With Quote
  #5  
Old July 20th, 2004, 04:18 PM
Lightnin Lightnin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 46 Lightnin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
In procedure clear() change teh code to:
Form1.lbIEURL.clear; //should work

Good Luck!!

Nitin

Last edited by Scorpions4ever : July 21st, 2004 at 08:19 PM.

Reply With Quote
  #6  
Old July 20th, 2004, 04:47 PM
Mortamer Mortamer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 36 Mortamer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 46 sec
Reputation Power: 5
not sure if I got that right, tried a couple different ways of implementing what you said, but I still get errors. Code:
Code:
unit Unit1;

interface

uses
	Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
	Dialogs, StdCtrls;

type
	TForm1 = class(TForm)
		Button1: TButton;
		lbIEURL: TListBox;
		procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
	public
		{ Public declarations }
	end;

var
	Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.clear;
begin
lbIEURL.clear; // error
end;

function GetUrlFromIE (Handle: THandle; List: TStringList): boolean; stdcall;
var
	hWndIE, hWndIEChild : HWND;
	Buffer : array[0..255] of Char;
begin
	//get the window caption
	SendMessage(Handle, WM_GETTEXT, 255, integer(@Buffer[0]));
	//look for the Internet Explorer window with "Buffer" caption
	hWndIE := FindWindow('IEFrame', Buffer);
	if hWndIE > 0 then
begin
		//try to get a handle to IE's toolbar container
		hWndIEChild := FindWindowEx(hWndIE, 0, 'WorkerW', nil);
		if hWndIEChild > 0 then
		begin
			//get a handle to address bar
			hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil);
			if hWndIEChild > 0 then
			begin
				//finally, locate combo box and add its text to the list
				hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil);
				if hWndIEChild > 0 then
				begin
					SendMessage(hWndIEChild, WM_GETTEXT, 255, integer(@Buffer));
					//List.AddObject(Buffer,TObject(hWndIE));
					List.Add(Buffer)
				end;
			end;
		end;
	end;
	//continue enumeration
	Result :=True;
end; (*GetUrlFromIE*)

procedure TForm1.Button1Click(Sender: TObject);
begin
 clear;  //if I put lbIEURL.clear here, it'd work
 EnumWindows(@GetUrlFromIE, LParam(lbIEURL.Items));
end;

end.

and the errors:
Code:
[Error] Unit1.pas(27): Undeclared identifier: 'clear'
[Error] Unit1.pas(29): Undeclared identifier: 'lbIEURL'
[Error] Unit1.pas(68): Undeclared identifier: 'clear'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'

Reply With Quote
  #7  
Old July 20th, 2004, 04:53 PM
Lightnin Lightnin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 46 Lightnin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
It shoudl either be :
procedure clear()
begin
Form1.lbIEURL.clear; //should work
end;

OR

declare a procedure in your private
procedure clear();

then you should have
procedure TForm1.clear();
begin
lbIEURL.clear;
end;

Good Luck

Last edited by Scorpions4ever : July 21st, 2004 at 08:19 PM.

Reply With Quote
  #8  
Old July 20th, 2004, 05:14 PM
Mortamer Mortamer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 36 Mortamer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 46 sec
Reputation Power: 5
Works like a charm, thanks a lot everyone!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > [Pascal Error] Unit1.pas(1): Unable to invoke Code Completion due to errors in source


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT