We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile Extension
#1
Litdev Can You Compile This Extension : https://www.mediafire.com/file/vzf45xnmh...xt.vb/file

And Can You Make An Extension Which Will In A File Read From Specific Line To Specific Line And Then Return It

And For Highlighting A Whole Line In Textbox When It Start With A Specific Character

And For Highlighting A Specific Text In Textbox Automatic
Reply
#2
Hi,

There is more to it than in your vb, I would have to rewrite it.

Realistically, I'm not going to write/rewrite extensions for you to everything you want.

I could help you learn to do it, but that really would require you having access to Visual Studio.

One option for you is to look into LDInline - see the sample that comes with LitDev samples in other-samples/LDInline-Reflection.sb with cs and vb code used.  This can take extension code and compile it into a function to be used in SB.  However, writing the CS code required to do what you want will be a steep learning curve - probably harder than writing the program directly in VS, requiring the use of reflection delegates to interact with the GraphicsWindow for example.  PS, this method can also create extension dlls with xml intellisense - I forgot it could do that!

Also look into LDRichTextBox which can change individual word colours.  See sample in other-samples/RichTextBox.sb.

I don't think this can easiliy be done for a textbox, your vb looks like it is for a winform textbox, not wpf and changing the selection colour is the colour for overlay when a word is selected, see https://stackoverflow.com/questions/3466...lects-text.
[-] The following 1 user Likes litdev's post:
  • AbsoluteBeginner
Reply
#3
Can You Give From Where I Could Learn CSharp Or VB
Reply
#4
Hi, There are plently online resources, but I believe it is essential to fist have access to Visual Studio.
Reply
#5
I Use A 32 Bit Computer Windows 8.1 And 2gb RAM

I Have MSBuild Tool
Reply
#6
Hi, I see the problem, perhaps Java or Python could be alternatives to look into, not for SB extensions but programming in general if the limitations of SB are too much.
Reply
#7
Please can you compile line reader and highlighter extension for svb
Reply
#8
Hi,

As I discussed:

1] The line reader can be done simply with existing SB methods - no need for extension.
2] The code you supplied for highlighting doesn't compile for SB or sVB, and if I corrected it the method you suggested only changes the highlight selection color (this is the background color when a user selects a bit of text), it does NOT set the font color of text - this CANNOT BE DONE for individual bits of text in a textbox.

These cannot help you with the language conversion project. I am unsure why you want this, rather than looking into how to perform the important functionality for this project with existing methods.

I can help you compile an extension yourself, or provide help with some of the suggestions I have made using for example LDInline, LDxml, LDConstrols.AddRichTextBox. I cannot write code for you, either extension or SB.
Reply
#9
The code for line reader can not work in textbook if can please explain me and for highlighter leave it for now
Reply
#10
You can test the extension dll for linereader I already sent you in standard Small Basic.

Look at the C# extension code:

Code:
        public static Primitive ReadLines(Primitive filePath, Primitive startLine, Primitive endLine)
        {
            if (!System.IO.File.Exists(filePath))
            {
                throw new FileNotFoundException("File not found", filePath);
            }

            if (startLine < 1 || endLine < 1 || endLine < startLine)
            {
                throw new ArgumentException("Invalid line numbers");
            }

            using (StreamReader reader = new StreamReader(filePath))
            {
                string line;
                string result = "";
                int currentLine = 0;

                while ((line = reader.ReadLine()) != null && currentLine < endLine)
                {
                    currentLine++;
                    if (currentLine >= startLine)
                    {
                        result += line + Environment.NewLine;
                    }
                }

                return result;
            }
        }
    }

When you test it in SB you will find that it does exactly the same as the text2 code below, which concatenates the lines to a single string with newline character.

Code:
xmlFile = "C:\Program Files (x86)\Microsoft\Small Basic\SmallBasicLibrary.xml"
text1 = ZSLineReader.ReadLines(xmlFile,3,5)
TextWindow.WriteLine(text1)

TextWindow.WriteLine("================================================")

text2 = ""
For i = 3 To 5
  text2 = Text2 + File.ReadLine(xmlFile,i)+Text.GetCharacter(10)
EndFor
TextWindow.WriteLine(text2)
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)