Menu

Stringgadget style

2020-04-09
2020-04-09
  • John Duchek

    John Duchek - 2020-04-09

    Sorry to be back again so soon. I am trying to use a string gadget and force the letters to uppercase using the style command. It doesn't seem to work, and I am hoping you will see what I am doing wrong. Thanks for any help, John
    Here is my code:

    Include "window9.bi"

    Dim As HWND hwnd
    dim as string formula
    Dim shared As integer event
    dim as integer ES_UPPERCASE

    hwnd=OpenWindow("test",2560-500/2,540-300/2,500,300)
    StringGadget(1,10,10,100,20,"",ES_UPPERCASE)

    Do
    event=WaitEvent()
    If event=EventClose Then End

    formula=GetGadgetText(1)
    print formula
    Loop

     
  • stabud

    stabud - 2020-04-09

    Hi John!

    Help indicates that style ES_UPPERCASE only for Windows. On Linux, you can try to edit the text in the callback function, but I don’t know how fast it will work:

    #include "window9.bi"
    
    Dim As HWND hwnd , edit
    
    dim as string formula
    
    Dim shared As integer event
    
    sub insertText (entry as any ptr,  user_data as gpointer) 
    
        dim as const zstring ptr pszText = gtk_entry_get_text(entry)
    
        if pszText andalso *pszText <> "" then
    
            dim as string sText = UCASE(wstr(*pszText))
    
            gtk_entry_set_text(entry , sText)
    
        EndIf
    
    End Sub
    
    hwnd=OpenWindow("test",2560-500/2,540-300/2,500,300)
    
    edit = StringGadget(1,10,10,100,20,"")
    
    g_signal_connect_after( edit, "changed", G_CALLBACK(@insertText), NULL )
    
    Do
    
        event=WaitEvent()
    
        If event=EventClose Then End
    
        formula=GetGadgetText(1)
    
        print formula
    
    Loop
    
     
  • John Duchek

    John Duchek - 2020-04-09

    Hi StaBud,
    I had missed the 'windows only' completely. Your alternative is working great; no hesitation at all. Thank you very much!
    John

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.