|
Hello everybody!
I've written a JavaCoder. With this program I can create,edit,... my java source files. I have even been able to highlight the syntax ( like in Visual Studio. NET ).
Now I've got a question:
How can I make a code-completion?
I use a richt-text-box to edit my files.
Can anyone help????
Thanks
petermax2
|
|
|
|
|
petermax2 wrote:
I use a richt-text-box to edit my files.
Not the best choice of editors. You spend more time overriding functionality than just doing a code editor from scratch. There are also many examples out there (see http://www.gotdotnet.com/workspaces[^]) that could give you some hints.
How do you get command-completion to work? For languages that support it, you use reflection (which Java supports). When you hit the member separator (typically "."), you reflect (and cache, if you haven't already - which is a good idea) the members. I assume you're doing this in C# since you're in the C# forum, so you'll need to use a native JNI DLL and encapsulate that in a managed class. Click "My Articles" in my sig and see my Java/.NET article for a discussion on that. See the JNI docs on Sun's http://java.sun.com[^] site for more information about using Java classes from C/C++.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
Not the best choice of editors.
What else can I use?
Regards
|
|
|
|
|
As I mentioned, right your own or borrow ideas appropriately from vast numbers of examples out there on the web. I even gave you a link to the GotDotNet workspaces where you'll find many examples. leppie - another regular on CodeProject - replied below that he's been working on one. There are tons of examples - just do some research if you don't know how to write a text editor.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
You spend more time overriding functionality than just doing a code editor from scratch.
Exactly what I have been doing the last 3 months, doing a custom rendered code editor. Still needs some work, but its almost done.
top secret
|
|
|
|
|
How did you start?
Can you give me some ideas?
Oh, and what means this:
leppie wrote:
top secret
???
Regards
|
|
|
|
|
petermax2 wrote:
How did you start?
I started thinking it wouldnt be more than a 1000 lines. Its 7000+ now! Most of the time was spent designing and developing fast algorithms to replace known slow operations. Thanks to my design, adding a new language hilighting scheme is a breeze (not always, need to make it better still), and it currently supports 5 langauges: C#, C, MSIL, Nemerle, and XML (beta).
petermax2 wrote:
Can you give me some ideas?
I'm going to be releasing the source under a GPL/LGPL license within the next 3 months.
Some ideas you mite wanna ponder on if you cant wait:
- Write down your goals and get the big picture on paper and stick to it. If you change it, start from scratch.
- Design, design, design (you can never be too sure).
- KISS, think how things exponitanally can affect future dependant operations.
- Fimiliarise yourself with how painting and clipping is done (a new article on CP is very informative on some painting stuff). Know the limits of related Drawing objects (like the maximum area of a region).
- Modularize all aspects, but keep them tighly integrated so information is not required to be duplicated. Memory and speed are your biggest enemies!
- Dont write any code until u know exactly what your design spec specifies and that it is known to work correctly. Run simulations in your head.
- DO NOT look at SharpDevelops attempt. It was a good design ruined by terribly sloppy coding.
- Think how things can be speeded up. eg you have a big file and you are near the end of the file, it will obviously be better to do calculations from the end (or even some nearer known point).
Now that I have scared you enough, I think a small wait will be worthwhile
petermax2 wrote:
???
It's meant to be an IRC link. Install mIRC!
Feel free to ask anymore questions.
top secret
|
|
|
|
|
leppie wrote:
Now that I have scared you enough
I'm not scared about this. I know that I can't write a code editor on one day.
You said Sharp Develop! I've got an idea! Is it possible to use components like CodeEditor,Windows Forms Designer from the Sharp Develop components?
Thank you for the information you gave me!
|
|
|
|
|
petermax2 wrote:
You said Sharp Develop! I've got an idea! Is it possible to use components like CodeEditor,Windows Forms Designer from the Sharp Develop components?
Its possible, but I can gaurentee you that you will be pulling your hair out, fixing bugs, and trying to understand someones idea of logic. Also there codeeditor component is a huge memory hog. My control uses a fraction of the memory used by the former. Try loading a big file in it say about 10mb, it will use close to 300mb of memory, where mine "only" use about 70-80mb.
Well if you decide to go for it, good luck!
top secret
|
|
|
|
|
Hello,
Can I install my service manually not using some kind of installutil.exe or install visard. May be I can connect to the SCM and install my service like I can do this under C++?
Regards
Alex
|
|
|
|
|
The ServiceController doesn't support the installation of services. You can use the AssemblyInstaller class, though, to load your assembly and run the installers in it. See the class documentation in the .NET Framework SDK for more information and an example of using it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am receiving ArgumentException: "Must specify value for source." But I specifying correct path to the assembly. What is the problem.
IDictionary mySavedState = new Hashtable();<br />
try<br />
{<br />
string[] commandLineOptions = new string[ 1 ] {"/LogFile=example.log"};<br />
System.Configuration.Install.AssemblyInstaller myAssemblyInstaller = new <br />
System.Configuration.Install.AssemblyInstaller( Application.ExecutablePath , commandLineOptions );<br />
myAssemblyInstaller.UseNewContext = true;<br />
myAssemblyInstaller.Install( mySavedState );<br />
myAssemblyInstaller.Commit( mySavedState );<br />
}<br />
catch (ArgumentException e)<br />
{<br />
string s = e.Message;<br />
}<br />
catch (Exception e)<br />
{<br />
Console.WriteLine( e.Message );<br />
}<br />
This code calling from service project to install itself
|
|
|
|
|
I threw together a simple example using the following code and it worked fine:
static void Main(string[] args)
{
if (args.Length > 0)
{
string[] rest = new string[args.Length - 1];
if (rest.Length > 0) args.CopyTo(rest, 1);
if (string.Compare(args[0], "/install", true) == 0)
{
Install(rest);
return;
}
else if (string.Compare(args[0], "/uninstall", true) == 0)
{
Uninstall(rest);
return;
}
}
ServiceBase.Run(new Service1());
}
static void Install(string[] args)
{
AssemblyInstaller installer = new AssemblyInstaller(
typeof(Service1).Assembly.Location, args);
IDictionary state = new Hashtable();
try
{
installer.UseNewContext = true;
installer.Install(state);
installer.Commit(state);
}
catch (Exception e)
{
installer.Rollback(state);
Console.Error.WriteLine(e.Message);
}
}
static void Uninstall(string[] args)
{
AssemblyInstaller installer = new AssemblyInstaller(
typeof(Service1).Assembly.Location, args);
IDictionary state = new Hashtable();
try
{
installer.Uninstall(state);
}
catch (Exception e)
{
Console.Error.WriteLine(e.Message);
}
} While Application.Location should return the correct path, it puts a possibly unnecessary dependency on the System.Windows.Forms.dll assembly. If you don't need to reference that assembly, just use Assembly.Location instead (there's many ways to get the current assembly, I just got it from the Type).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you,
I can see my mistakes now. But I have one more question: the code you write will install assembly as what? I cann't find service in Services applet with DisplayName of my service.
Regards
|
|
|
|
|
Make sure both the ServiceInstaller and ServiceProcessInstaller instances you've configured are added to your own Installer class derivative, which must be attributed with the RunInstallerAttribute with true in the constructor, otherwise the AssemblyInstaller won't know what class(es) are the installers and will do nothing of importance.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey,
I have a problem with C# DATAGRIDs. This is exactly what I am trying to do :
(Suppose)We have got a datagrid with 1 column (named customer, eg.). In the column cells the user is supposed to type customer codes which -let's say- are 8 characters long.
It would be interesting that whenever the user types in 8 characters in a cell that the corresponding customer's name will be displayed somewhere on the windows form..
Obviously, we need to define and use SOME EventHandler..
I tried to use a DataGridTableStyle with one DataGridTextBoxColumn, then I added this :
<code>DataGridTextBoxColumn nameColumnStyle = new DataGridTextBoxColumn();
...
nameColumnStyle.TextBox.TextChanged += new System.EventHandler(textBox_TextChanged);</code>
But it seems not to work!!
Even when I use this :
<code>...
nameColumnStyle.TextBox.Leave += new System.EventHandler(textBox_Leave);
...,</code>
the method textBox_Leave(..) is executed only once I click with the mouse on another cell, but never when I leave the cell using the left or down arrow for example!?
<b>I really need your help PLEASE!</b>
|
|
|
|
|
benq wrote:
I tried to use a DataGridTableStyle with one DataGridTextBoxColumn, then I added this :
DataGridTextBoxColumn nameColumnStyle = new DataGridTextBoxColumn();
...
nameColumnStyle.TextBox.TextChanged += new System.EventHandler(textBox_TextChanged);
But it seems not to work!!
You didn't mention what didn't work, but this works fine for me:
private void TextBox_TextChanged(object sender, EventArgs e)
{
TextBox tBox = (TextBox)sender;
if(tBox.Text.Length == 8)
Console.WriteLine(tBox.Text);
}
Charlie
if(!curlies){ return; }
|
|
|
|
|
TextChanged is fired AFTER (hence the past-tense "Changed") the text is commited, not while it's being typed.
Handle the KeyDown event. Verify the length and cancel the event (set KeyEventArgs.Handled to true ) if necessary.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i want to know how to get running application in windows xp through c# application, i thought that GINA.dll will help me but it didnt work
|
|
|
|
|
u must install dot net framwork in the xp windows installing component
|
|
|
|
|
amal_pro83 wrote:
how to get running application in windows xp through c# application, i thought that GINA.dll will help me but it didnt work
Where do you get that idea from? GINA is for user identification and authentication. That screen where NT/2000 said "Press Ctrl-Alt-Delete to logon" ... that's GINA...
Getting the Process list is easy. Look into "System.Process" class, here[^]. You'll need to import the System.Diagnostics namespace to use it.
RageInTheMachine9532
|
|
|
|
|
i got idea, from task manager u get from GINA got me , okay....i want to get opened applications..i know code of Process but i dont want all running exe on computer as most of them are services..i just want only applications running...breifly, all appear in taskbar as opened..got it
|
|
|
|
|
The Task Manager isn't part of GINA. But, it can be launched by it...
You'd have tp do some detective work to fish out the services from the applications. All a service is is a windowless application that runs in the background under a different user and desktop.
RageInTheMachine9532
|
|
|
|
|
thanks i did it
public static string[] Detect_Run_App()
{
int j=0;
Process[] processes=Process.GetProcesses();
for(int i=0; i
|
|
|
|
|
Told ya!
All it takes is a little research...
RageInTheMachine9532
|
|
|
|