part-cw / lambdanative

LambdaNative is a cross-platform development environment written in Scheme, supporting Android, iOS, BlackBerry 10, OS X, Linux, Windows, OpenBSD, NetBSD, FreeBSD and OpenWrt.
http://www.lambdanative.org
Other
1.39k stars 85 forks source link

Local button alignment #245

Open saman-pasha opened 5 years ago

saman-pasha commented 5 years ago

I wrote codes as these

;; side elements
       (let* ((elm-w side-w)
          (elm-h bar-h)
          (elm-y (lambda (i) (- h (* (+ i 2) elm-h))))
          (side-elms (list
              (glgui-button-local side-bar 0 (elm-y 0) elm-w elm-h "search" farsi_16.fnt
                          (lambda (gui wgt t x y)
                        (display "Element Clicked")))
              (glgui-button-local side-bar 0 (elm-y 1) elm-w elm-h "newarticle" farsi_16.fnt
                          (lambda (gui wgt t x y)
                        (display "Element Clicked")))
              (glgui-button-local side-bar 0 (elm-y 2) elm-w elm-h "articles" farsi_16.fnt
                          (lambda (gui wgt t x y)
                        (display "Element Clicked")))
              (glgui-button-local side-bar 0 (elm-y 3) elm-w elm-h "settings" farsi_16.fnt
                          (lambda (gui wgt t x y)
                        (display "Element Clicked")))
              (glgui-button-string side-bar 0 (elm-y 4) elm-w elm-h "Settings" latin_16.fnt
                           (lambda (gui wgt t x y)
                         (display "Element Clicked")))
              )))
     (for-each (lambda (elm)
             (glgui-widget-set! side-bar elm 'solid-color #t)
             (glgui-widget-set! side-bar elm 'color ac-color)
             (glgui-widget-set! side-bar elm 'button-normal-color fg-color)
             (glgui-widget-set! side-bar elm 'direction GUI_RIGHTTOLEFT)
             (glgui-widget-set! side-bar elm 'align GUI_ALIGNRIGHT)
             (glgui-widget-set! side-bar elm 'modal #t))
           side-elms)))

glgui-button-local s doesnt take alignment and always are in center and same about direction, multi part strings like آگهی های من shows as من های آگهی

but in glgui-button-string all works correct

another issue is about icon on button-local that when is set, does not show anything (glgui-widget-set! g btn 'icon icon.img) I put icon.png in textures folder that works for normal buttons

ddunsmuir commented 5 years ago

There are definitely limitations to (glgui-button-local) as what it uses for display depends on if you are using FONTS or STRINGS. If you are using FONTS (ie. text for that selected language directly in the localization file), then it uses (glgui-button-string) and thus you have access to all the features of a label. If instead you specify a texture with [t] in your localization file, then it uses (glgui-button) and the texture created is used as the image for the button. There is no separate icon.

I assume you are using [t] to have the Farsi characters connect, and therefore you can't use alignment or icons. These don't exist as attributes for a regular glgui-button. You can use // in your STRINGS file to force a new line where you want it. Unfortunately you would just need to change the dimensions/location of the button based on language if you want it to be to the left, right, top, bottom, etc. It is basically just a button with an image.

We welcome any contributions to the localization_gui.

saman-pasha commented 5 years ago

How can i contribute to this module?

ddunsmuir commented 5 years ago

Sorry for the very late reply. Please make a pull request if you would like to contribute and we will assess if there's any negative side effects and hopefully merge it in.

peterlew commented 4 years ago

As Dustin commented above, it seems likely that the lack of functionality comes from text that is declared in STRINGS, which then renders as an image on a glgui-button, and has no connection to 'direction 'align or 'icon. I've looked into this and would be happy to discuss it more, particularly the issue with آگهی های من showing up as من های آگهی . I don't know why this would be, and we would need to know a bit more about your setup to figure it out, if you're still interested. Are you using the STRINGS file to set these strings? Thanks!

saman-pasha commented 4 years ago

otozy.zip I changed my OS from Redhat to Ubuntu, and now download lambdanative again and rebuild project and direction goes correct but alignment and editable of local label doesnt work find out search.scm in attached zip file

saman-pasha commented 4 years ago

I need get localized input from user how could i do that?

peterlew commented 4 years ago

Hi, thank you for sending your project. The glgui-button-local makes a glgui-button in this case, so you can only use properties of glgui-button.

For localized input, our system only has a latin keyboard. Do you need a different character set?

saman-pasha commented 4 years ago

My project is related to text articles and mixed latin and persian inputs. I wonder if lambdanative had better strings localization and utf-8 support

mgorges commented 4 years ago

It does have UTF8 support, you can build all fonts with an extended ascii set, however, it will not merge characters or do any other fancy things - this will only happen for pre-rendered textures in LaTeX. If you need a non-native keyboard, you could try if you get somewhere with modules/native-keypad/native-keypad.scm, but I don't think these have ever been tested for that purpose either.