Announcement

Collapse
No announcement yet.

Textbox attributes issue (Windows bug?)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Textbox attributes issue (Windows bug?)

    Question!
    I have a text box that I use to input text with, it works great...
    Now, I want a preview dialog box to preview the dialog box windows issues prior to a login.
    So I built it identical to the Windows dialog box (On NT only, 98 uses MessageBox)..
    Everything is great except I notice NT's is read only on the text box displaying the official warning (Whatever company or Gov institude that implements these)...

    So I have two text boxes. The difference between them is that #1 is NOT read only and is VSCROLL.
    #2 duplicates Windows NT textbox and does not have VSCROLL and is READONLY.

    Works:
    Control Add TextBox,hDlg,%IDMAIN_TEXT2,g_MsgText,5,45,240,80,_
    %WS_VSCROLL Or %ES_MULTILINE Or %ES_WANTRETURN Or %ES_LEFT Or %WS_TABSTOP,%WS_EX_CLIENTEDGE
    Fails:
    Control Add TextBox,pDlg,%ID_PREV_TEXT1,sText,10,10,260,157,
    %ES_READONLY Or %ES_MULTILINE Or %ES_WANTRETURN Or %ES_LEFT Or %WS_TABSTOP,%WS_EX_CLIENTEDGE

    The issue here is that in Windows NT I can highlight the text and drag my mouse down.
    in *MY* text box it just flat out CHOPS the text off and does not display it below the end of the textbox...

    Download this app if you want a REALLY good look.
    It's not a huge deal but I want it to duplicate NT (It's a "Preview" button)..
    http://www.tngbbs.com/ccs/files/logonmsg.zip


    Anyway, perhaps I'm missing something, and in addition, how do I get the title bar to have text and have ONE X on the right side WITHOUT having the Windows icon?
    I'm using %WS_CAPTION Or %WS_SYSMENU right now, not quite right...

    Thanks,

    Scott

    ------------------
    Scott
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    Following gives you a dialog with a read-only textbox in correct
    color, and other icon. Not sure if you meant no icon/sysmenu and
    still have the x (close)? Is that possible? Don't know. BTW, also see
    sample of using Rich edit for this purpose in other, recent thread.
    Code:
    #COMPILE EXE
    #INCLUDE "WIN32API.INC"
    %ID_TEXT = 20
    DECLARE CALLBACK FUNCTION DlgProc() AS LONG
     
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    ' Create dialog and controls, etc
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    FUNCTION PBMAIN () AS LONG
      LOCAL hDlg AS LONG, s AS STRING
      s = REPEAT$(50, "Lots of text to copy and read. ")
     
      DIALOG NEW 0, "Preview",,, 180, 130, %WS_CAPTION OR %WS_SYSMENU, 0 TO hDlg
      DIALOG SEND hDlg, %WM_SETICON, %ICON_SMALL, LoadIcon(%NULL, BYVAL %IDI_ASTERISK)
     
      CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&OK", 125, 110, 50, 14, %WS_TABSTOP
      CONTROL ADD TEXTBOX, hDlg, %ID_TEXT, s, 4,  4, 172, 100, %WS_CHILD OR _
                                 %ES_MULTILINE OR %WS_VSCROLL OR %WS_TABSTOP, _
                                 %WS_EX_CLIENTEDGE CALL DlgProc
      CONTROL SEND hDlg, %ID_TEXT, %EM_SETREADONLY, 1, 0
      CONTROL SET FOCUS hDlg, %ID_TEXT                '<- first set focus to edit
      CONTROL SEND hDlg, %ID_TEXT, %EM_SETSEL, -1, 0  '<- then reset selection
     
      DIALOG SHOW MODAL hDlg CALL DlgProc
    END FUNCTION
     
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    ' Main callback
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    CALLBACK FUNCTION DlgProc() AS LONG
      SELECT CASE CBMSG          'Note: read-only textbox acts as Static label..
         CASE %WM_CTLCOLORSTATIC : FUNCTION = GetStockObject(%WHITE_BRUSH)
         CASE %WM_COMMAND        : IF CBCTL = %IDCANCEL THEN DIALOG END CBHNDL
      END SELECT
    END FUNCTION

    ------------------

    Comment


    • #3
      He, while working with something else, I noticed one of the dialogs
      I was using had exactly what you were looking for, title, x and no
      icon/system menu. Simply use %DS_MODALFRAME OR %WS_CAPTION OR %WS_SYSMENU
      as style, and you are there..

      (If to use in sample above, remove WM_SETICON call)

      ------------------

      Comment


      • #4
        Thanks,
        The dialog box is fixed now, no icon, just an X plus text on the title...

        But do I really have to go through all of that to be able to put all of the text and highlight (and scroll while highlighted) on a read only textbox?

        Perhaps if I tried a rich edit box? I will and see if that changes anything....
        Should be straight forward....


        ------------------
        Scott
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment

        Working...
        X