Recent

Author Topic: TextBox with BGRA rendering  (Read 1892 times)

hedgehog

  • New Member
  • *
  • Posts: 48
TextBox with BGRA rendering
« on: May 07, 2024, 12:54:27 pm »
Hi all!

I'm currently working on a single-line text editing component, using BGRA for rendering.

And in the process of this work I learned a lot of new things. For example, that VinControl can be made transparent.

I ask you to express your opinion and suggest how this can be improved using the full power of BGRA

lainz

  • Hero Member
  • *****
  • Posts: 4686
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: TextBox with BGRA rendering
« Reply #1 on: May 07, 2024, 02:47:13 pm »
Hi, looking good

Do you have a github account? So I can add you as bgracontrols developer?

You already did several contributions.

hedgehog

  • New Member
  • *
  • Posts: 48
Re: TextBox with BGRA rendering
« Reply #2 on: May 07, 2024, 04:21:31 pm »
Hi Lainz.
Yes, https://github.com/hedgehog344
I'm not a professional programmer. And I probably have impostor syndrome. ;D

lainz

  • Hero Member
  • *****
  • Posts: 4686
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: TextBox with BGRA rendering
« Reply #3 on: May 07, 2024, 04:34:19 pm »
Hi Lainz.
Yes, https://github.com/hedgehog344
I'm not a professional programmer. And I probably have impostor syndrome. ;D

I invited you.

I started as non professional with BGRAControls. Then I get a job as programmer, so keep going  :)

circular

  • Hero Member
  • *****
  • Posts: 4383
    • Personal webpage
Re: TextBox with BGRA rendering
« Reply #4 on: May 09, 2024, 10:10:24 pm »
Hi hedgehog,

The component looks great.  :)

There are some additional subtleties with text that could be taking into account. You'll find a unit for that called BGRATextBidi with TBidiTextLayout class. It handles all sorts of things like bidirectional text (for example arabic is right-to-left and it is possible to mix text directions) and multichar glyphs (for example accents can be added as non spacing characters and some characters can merge).

There is a sample project on how to use it: https://github.com/bgrabitmap/bgrabitmap/tree/master/test/testbiditext2

It handles multiline text as well, though you can use it for single line text by making sure there are no end of lines (#13, #10, unicode paragraph and line separators) in the text. Tabs (#9) also have a special effect. You'll find constants for common unicode separators in BGRAUTF8.

Welcome to BGRA adventure. It is heartwarming to see new faces proposing new kind of contributions!
Conscience is the debugger of the mind

hedgehog

  • New Member
  • *
  • Posts: 48
Re: TextBox with BGRA rendering
« Reply #5 on: May 10, 2024, 07:11:38 am »
There is a sample project on how to use it: https://github.com/bgrabitmap/bgrabitmap/tree/master/test/testbiditext2

Hi!
I'm shocked!
You opened the door to a cave full of treasures for me!
I didn’t know that BGRA had a ready-made text editor (I’m throwing ashes on my head)

Perhaps we could just take this code and transform it into a component?
(I felt like I did a lot of useless work)

circular

  • Hero Member
  • *****
  • Posts: 4383
    • Personal webpage
Re: TextBox with BGRA rendering
« Reply #6 on: May 10, 2024, 10:10:29 am »
Hi hedgehog,

Creating your component with the text selection was a great way to have a deeper understanding of the subject. This effort in learning and development will give you more insights if you integrate my text layout class.

You can indeed inspire from the sample project for your component, either by modifying your component or transforming the sample and adding the styling and placeholder text.

Even though the BGRATextBidi unit can streamline your project, there are some nuances to be considered, as mentioned previously, considering the effect of paragraph and line separators. It cloud be worth considering making a component that can be multiline or not, depending on the value of a property.

What do you think?
Conscience is the debugger of the mind

hedgehog

  • New Member
  • *
  • Posts: 48
Re: TextBox with BGRA rendering
« Reply #7 on: May 10, 2024, 11:55:02 am »
Creating your component with the text selection was a great way to have a deeper understanding of the subject.
As they say in the books, the carpenter had an exam - to make a stool.
So, I made a stool, it’s crooked, but you can sit on it. No ass gets hurt... probably :-\

It cloud be worth considering making a component that can be multiline or not, depending on the value of a property.
What do you think?
Of course, this is the first thing that comes to mind.
My goal was to create a simple one-line editor that could be decorated however you wanted.
But, if you add multi-line, then the internal logic should be completely different, for example, the text will need to be stored in pieces in a doubly linked list.
And this is no longer a stool, but a large closet!

circular

  • Hero Member
  • *****
  • Posts: 4383
    • Personal webpage
Re: TextBox with BGRA rendering
« Reply #8 on: May 11, 2024, 10:25:28 pm »
Actually, you don't need to handle the paragraph thing yourself, it's taken care of by TBidiTextLayout class. It contains functions to modify the text according to key events.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018