XusinboyBekchanov / MyFbFramework

My FreeBasic Framework
Other
65 stars 18 forks source link

Improve: Minimum using of function RequestAlign #174

Closed hustbeef closed 5 months ago

XusinboyBekchanov commented 5 months ago

Therefore I cannot accept this request.

hustbeef commented 5 months ago

So far everything is working fine on my laptop. We can switch back if something goes wrong.

XusinboyBekchanov commented 5 months ago

Just try, click on CommandButton1, after clicking automatically the Top of the Form goes to 0:

'#Region "Form"
    #if defined(__FB_MAIN__) AndAlso Not defined(__MAIN_FILE__)
        #define __MAIN_FILE__
        #ifdef __FB_WIN32__
            #cmdline "Form1.rc"
        #endif
        Const _MAIN_FILE_ = __FILE__
    #endif
    #include once "mff/Form.bi"
    #include once "mff/CommandButton.bi"

    Using My.Sys.Forms

    Type Form1Type Extends Form
        Declare Sub CommandButton1_Click(ByRef Sender As Control)
        Declare Constructor

        Dim As CommandButton CommandButton1
    End Type

    Constructor Form1Type
        #if _MAIN_FILE_ = __FILE__
            With App
                .CurLanguagePath = ExePath & "/Languages/"
                .CurLanguage = .Language
            End With
        #endif
        ' Form1
        With This
            .Name = "Form1"
            .Text = "Form1"
            .Designer = @This
            .SetBounds 0, 0, 350, 300
        End With
        ' CommandButton1
        With CommandButton1
            .Name = "CommandButton1"
            .Text = "CommandButton1"
            .TabIndex = 0
            .SetBounds 90, 150, 140, 50
            .Designer = @This
            .OnClick = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control), @CommandButton1_Click)
            .Parent = @This
        End With
    End Constructor

    Dim Shared Form1 As Form1Type

    #if _MAIN_FILE_ = __FILE__
        App.DarkMode = True
        Form1.MainForm = True
        Form1.Show
        App.Run
    #endif
'#End Region

Private Sub Form1Type.CommandButton1_Click(ByRef Sender As Control)
    Left = 10
End Sub
XusinboyBekchanov commented 5 months ago

Here it is in your version (without RequestAlign): image

XusinboyBekchanov commented 5 months ago

Here it is in your version (Properties Window): image

hustbeef commented 5 months ago
  1. Top is set to 0 because the default value is not specified.
  2. Regarding RequestAlign, it works fine on my laptop, but we should minimize the use of the RequestAlign function.
  3. I want to cancel this post.
hustbeef commented 5 months ago

For RichTextBox, Now the code not working but before it is OK

InfoStrRTF = "{\rtf1\ansi\ansicpg936\deff0\nouicompat\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fprq2\fcharset134 \'ce\'a2\'c8\'ed\'d1\'c5\'ba\'da;}}"
                        InfoStrRTF += "{\colortbl ;\red0\green0\blue0;\red155\green0\blue211;\red0\green176\blue80;\red255\green0\blue0;\red0\green77\blue187;}"
                        InfoStrRTF += "{\*\generator Riched20 10.0.19041}{\*\mmathPr\mnaryLim0\mdispDef1\mwrapIndent1440 }\viewkind4\uc1\pard\nowidctlpar"
InfoStrRTF = InfoStrRTF & "\cf0\f0\fs16 " & "你好,世界"
InfoStrRTF = InfoStrRTF  + "\cf4\f0\fs16 " + "你好,世界" + " \par "
RichTextBox_log.TextRTF =  InfoStrRTF  + "}"
XusinboyBekchanov commented 5 months ago

Top is set to 0 because the default value is not specified.

To go to "Move FLeft, FTop, FWidth, FHeight", you must first set the value for these variables (FLeft, FTop, FWidth, FHeight) in the WM_MOVE, WM_SIZE events, each time you move, resize.

Regarding RequestAlign, it works fine on my laptop, but we should minimize the use of the RequestAlign function.

I think the Windows versions handle this the same way.

For RichTextBox, Now the code not working but before it is OK

That's okay:

image

XusinboyBekchanov commented 5 months ago

Is your InfoStrRTF a String? Must be UString.

XusinboyBekchanov commented 5 months ago

In Russian Windows they can work with Cyrillic using a simple String, in Chinese Windows they can also work with a simple String to display Chinese characters, but in Russian Windows they cannot just use Chinese characters, and in Chinese Windows they also cannot use Russian characters without WString.

hustbeef commented 5 months ago

I am not sure why it is working with "Dim As String Buffer = ToUtf8(Value)" in the IDE code. Does the textRTF only accept UTF8? However, "{\rtf1\ansi\ansicpg936\" is working fine in the previous version. See also rich-text-format

hustbeef commented 5 months ago

Could you please add color to the text in the richTextBox?

XusinboyBekchanov commented 5 months ago

I am not sure why it is working with "Dim As String Buffer = ToUtf8(Value)" in the IDE code. Does the textRTF only accept UTF8? >However, "{\rtf1\ansi\ansicpg936" is working fine in the previous version. See also rich-text-format

Yes, UTF8 accepts.

Could you please add color to the text in the richTextBox?

RichTextBox has properties BackColor, ForeColor, also SelBackColor and SelColor

XusinboyBekchanov commented 5 months ago

However, "{\rtf1\ansi\ansicpg936" is working fine in the previous version.

String cannot contain Unicode characters (without UTF8), only depending on the regional Windows can contain these strings, otherwise question marks appear along with them when setting the Unicode string.

XusinboyBekchanov commented 5 months ago

Each letter in the String is 1 byte. 256 bit. 0 to 255 cannot contain all the letters of all languages in the world. Can only contain all letters of one national language (depending on the regional Windows).

hustbeef commented 5 months ago

Question marks do not appear along with them when setting the Unicode string. As the same the image you posted incorrectly decoded?

XusinboyBekchanov commented 5 months ago

It was not decoded, there is no Unicode in the text, there is only a question mark. The question mark cannot be decoded in any way.