Results 1 to 27 of 27

Thread: Right to left

  1. #1

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73

    Question Right to left



    I wanted a right-to-left edit box for an Arabic application in visual basic and i got it, the code for it is :

    first set the alignment of the text box to right

    then add the following code to the change() event of the text box

    Text1.SelStart=0

    but the problem is that it takes the cursor to the start of the textbox, it does not add the character to before the current character position.

    what shall i do in this case....

    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  2. #2
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    It works fine. You want to make the cursor move right when a character is typed.

  3. #3

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73

    Question RTL Problem

    Is there another way to insert a character to the right when the character is typed.

    other than "text1.selstart=0"

    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  4. #4
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    To the right just leave the Default Properties. Or what you mean is to the Left.

  5. #5

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73
    when the enter is pressed the line is feeded at the top not at the bottom,

    please test it then you will understand.
    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  6. #6

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73
    is there any api to move back the cursor one character.
    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  7. #7
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    Ok i got what you are saying. Let me see if i can come up with something

  8. #8
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    I MADE IT!

    It works sooo good

    Here's the code. Remember to make it multi-line and right-aligned

    Code:
    
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        If KeyAscii = vbKeyBack Then
            Text1.SelLength = 1
            Text1.SelText = ""
        ElseIf KeyAscii = vbKeyReturn Then
            Dim i As Long
            For i = Text1.SelStart + 1 To Len(Text1.Text) - 1
                If Mid(Text1.Text, i, 1) = vbCr Then
                    Exit For
                End If
            Next i
            Text1.SelStart = i
            Text1.SelLength = 0
            Text1.SelText = vbCrLf
        Else
            Text1.SelText = Chr(KeyAscii)
            Text1.SelStart = Text1.SelStart - 1
        End If
        
        KeyAscii = 0
    End Sub
    That's been tested on a Portuguese system, not Arabian. But it should work (I can write backwards ).

    {EDIT}

    Sorry, I mispelled "good" and wrote Arabian without the capped "A"
    (Sorry, but I'm a perfectionist )
    Last edited by Jotaf98; May 27th, 2001 at 04:43 PM.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    If you're using an Arabic locals you should be able to simply set the RightToLeft property to True.

  10. #10
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Yeah, but what's the fun of it? What about if his system is not Arabic?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  11. #11
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Well if your making an Arabic application the chances that your using an Arabic system locals is pretty hight, don't you think?

  12. #12

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73

    Thank's Jotaf98 I made it.

    thank's alot.
    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  13. #13

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73
    Thnks Jotaf but there is one another problem,

    When the no of characters exceeds the width there is a problem,
    I cant say it in words, you can check it your self,Would you please.
    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  14. #14
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Ok, but I can't check it out until I get home 'cause I'm at school right now
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  15. #15

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73

    Thumbs up

    Hey jotaf98 did you get home......
    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  16. #16
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Yeah, sorry - I forgot about this thread

    I thought that was exactly what you wanted to happen. I mean, it passes the first (right-most) word to the end of the next line... isn't that how it should be in Arabic? What do you want it to be like?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  17. #17

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73
    No only in this case it shall act like english, I mean that the last (left-most) word should go to the new line...
    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  18. #18

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73

    Hey Jotaf98

    Did you understand!
    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  19. #19
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    why are Arabians backwards anyway?! They should type like everyone else. Not trying to be racist or anything.
    <removed by admin>

  20. #20
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Originally posted by MidgetsBro
    why are Arabians backwards anyway?! They should type like everyone else. Not trying to be racist or anything.
    There is actually more people in the world that, if they can write , types from right to left or from top to bottom and right to left then there is people typing left to right...
    Just think of all the chinese in the world....

  21. #21
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Hum... well... I tried fixing it, but with no luck

    The only thing I managed to pull out of it was checking if the current line is bigger than the width of the textbox. Does anyone have any idea as to what should I do once I get this?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  22. #22
    Fanatic Member BrianHawley's Avatar
    Join Date
    Aug 2001
    Location
    Saudi Arabia
    Posts
    796

    Lightbulb Write-to-left (off-topic?)

    Everybody writes right-to-left (at least numbers) because we stole the Arabic system when we found Roman numerals unsuited to calculation. Never wondered why numerals are described as Arabic or Roman? Anyway, write down a list of 6 digit numbers. Add them up. Which way did you write the answer? Right-to-left! Strangely most Arabs now use Hindi numerals, not Arabic ones. And they write down telephone numbers the same way Westerners do.

  23. #23
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Heh, never thought of that
    Yeah, you're right, but when you're reading a number, eg.: 39, you read from left to right, "thirty-nine"
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  24. #24
    Fanatic Member BrianHawley's Avatar
    Join Date
    Aug 2001
    Location
    Saudi Arabia
    Posts
    796
    Err... yes, you're right. Can't think of a snappy reply to that one.

    Tried your cat experiment. Doesn't work. Cat lands right side up, presumably proving that the cat has more effect than the toast. Maybe something to do with having nine lives (is the cat running multiple threads?). I want to try again with nine slices of toast but I can't find a cat big enough.

  25. #25
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Try tiny ones instead
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  26. #26

    Thread Starter
    Lively Member israr's Avatar
    Join Date
    May 2001
    Posts
    73

    Red face Can't anybody help me

    I am stucked

    What shall I do know.
    Private Sub VBForums_Newthread()
    If Thread.Question = Hard then
    MSGBox "No one can reply..."
    Else If Thread.Question=Easy then
    Print "It's very easy.."
    MsgBox "God helps those who helps themselves."
    End If
    End sub

  27. #27
    Fanatic Member BrianHawley's Avatar
    Join Date
    Aug 2001
    Location
    Saudi Arabia
    Posts
    796
    If you are trying to write a right-to-left application to run under a version of Windows that does not support right-to-left, then with all proper respect to you, I think you are wasting your time.

    There are a HUGE number of things to consider in right-to-left languages, and Microsoft has already done it all and provided it all in the Arabic version of Windows (which runs Urdu applications pretty well).

    We wrote the first Arabic layer for Windows 3.11, way back years ago. It took us three man-years to do it, and it was a complete waste of time because Arabic Windows came out soon later.

    If you make a VB app to run on Windows Arabic, then all you need to do is Text1.RightToLeft= True, and you have exactly what you need. Also handles all the other stuff automatically for you, like mixed Arabic/English, numbers (Roman, Hindi or contextual), cut and paste of Arabic/Latin text, ligatures, diacritics, hot keyboard switching, etc.. etc... It's just not practical to try to write it yourself. It would take months and months, and its all been done already for you anyway.
    Brian
    (Fighting with the RightToLeft bugs in VS 2005)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width