home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / code / system / callback / wordbrea.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1995-02-27  |  4.5 KB  |  135 lines

  1. VERSION 2.00
  2. Begin Form frmWordBreak 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "WordBreak"
  5.    ClientHeight    =   4140
  6.    ClientLeft      =   1092
  7.    ClientTop       =   1488
  8.    ClientWidth     =   4068
  9.    Height          =   4560
  10.    Left            =   1044
  11.    LinkTopic       =   "Form2"
  12.    ScaleHeight     =   4140
  13.    ScaleWidth      =   4068
  14.    Top             =   1116
  15.    Width           =   4164
  16.    Begin SSCheck cWordBreak 
  17.       Caption         =   "WordBreak "
  18.       Height          =   270
  19.       Left            =   135
  20.       TabIndex        =   1
  21.       Top             =   2655
  22.       Width           =   1365
  23.    End
  24.    Begin CBVBX ctlWordBreak 
  25.       CBType          =   17  ' 17 - WordBreakProc
  26.       Left            =   0
  27.       Top             =   0
  28.    End
  29.    Begin TextBox eWordBreak 
  30.       Height          =   1515
  31.       Left            =   90
  32.       MultiLine       =   -1  'True
  33.       TabIndex        =   0
  34.       Text            =   "Dies ist ein WordBreak-Test. Bei eigener Wortumbruch-Prozedur werden die Zeilen auch an einem Bindestrich umgebrochen."
  35.       Top             =   975
  36.       Width           =   2025
  37.    End
  38.    Begin Label Label2 
  39.       BackStyle       =   0  'Transparent
  40.       Caption         =   "Geben Sie im Eingabefeld einen Text ein und sehen Sie  was bei eingeschaltetem und abgeschaltetem Wordbreak passiert."
  41.       FontBold        =   0   'False
  42.       FontItalic      =   0   'False
  43.       FontName        =   "MS Sans Serif"
  44.       FontSize        =   9.6
  45.       FontStrikethru  =   0   'False
  46.       FontUnderline   =   0   'False
  47.       Height          =   855
  48.       Left            =   90
  49.       TabIndex        =   4
  50.       Top             =   60
  51.       Width           =   3855
  52.    End
  53.    Begin Label Label1 
  54.       BackStyle       =   0  'Transparent
  55.       Caption         =   "Jetzt wird der Wortumbruch  an Leerzeichen und an Bindestrichen durchgef
  56. hrt."
  57.       FontBold        =   0   'False
  58.       FontItalic      =   0   'False
  59.       FontName        =   "MS Sans Serif"
  60.       FontSize        =   9.6
  61.       FontStrikethru  =   0   'False
  62.       FontUnderline   =   0   'False
  63.       Height          =   1305
  64.       Index           =   1
  65.       Left            =   1695
  66.       TabIndex        =   3
  67.       Top             =   2655
  68.       Visible         =   0   'False
  69.       Width           =   2265
  70.    End
  71.    Begin Label Label1 
  72.       BackStyle       =   0  'Transparent
  73.       Caption         =   "Jetzt wird der Wortumbruch nur an Leerzeichen durchgef
  74. hrt."
  75.       FontBold        =   0   'False
  76.       FontItalic      =   0   'False
  77.       FontName        =   "MS Sans Serif"
  78.       FontSize        =   9.6
  79.       FontStrikethru  =   0   'False
  80.       FontUnderline   =   0   'False
  81.       Height          =   1350
  82.       Index           =   0
  83.       Left            =   1695
  84.       TabIndex        =   2
  85.       Top             =   2655
  86.       Width           =   2250
  87.    End
  88. Option Explicit
  89. Sub ctlWordBreak_WordBreakProc (szEditText As Long, chCurrentWord As Integer, cbEditText As Integer, Action As Integer, retval As Integer)
  90.     Dim s$, c$, i%, l%
  91.     s$ = StringAtAdress(szEditText)
  92.     i = chCurrentWord
  93.     Select Case Action
  94.         Case WB_ISDELIMITER:
  95.             c$ = Mid$(s, i + 1, 1)
  96.             If c = " " Or c = "-" Then
  97.               retval = True
  98.               Exit Sub
  99.             End If
  100.         Case WB_RIGHT:
  101.             l% = Len(s$)
  102.             While Mid$(s$, i + 1, 1) <> " " And Mid$(s$, i + 1, 1) <> "-" And i% <= l%
  103.                 i = i + 1
  104.             Wend
  105.             retval = i
  106.         Case WB_LEFT:
  107.             While Mid$(s$, i + 1, 1) <> " " And Mid$(s$, i + 1, 1) <> "-" And i% + 1 > 1
  108.                 i = i - 1
  109.             Wend
  110.             retval = i
  111.     End Select
  112. End Sub
  113. Sub cWordBreak_Click (Value%)
  114.     Dim dummy
  115.     Dim a$
  116.     If cWordBreak.Value Then
  117.         Label1(1).Visible = True
  118.         Label1(0).Visible = False
  119.         ctlWordBreak.WordBreakWnd = eWordBreak.hWnd
  120.     Else
  121.         Label1(0).Visible = True
  122.         Label1(1).Visible = False
  123.         ctlWordBreak.WordBreakWnd = 0
  124.     End If
  125.     '
  126. nderung im Edit Control provozieren.
  127.     'Dabei durch manuelles Setzen des Redraw-Flags ein
  128.     'Flackern vermeiden.
  129.     a$ = eWordBreak.Text
  130.     'dummy = SendMessage(eWordBreak.hWnd, WM_SETREDRAW, ByVal False, ByVal 0&)
  131.     eWordBreak.Text = ""
  132.     eWordBreak.Text = a$
  133.     'dummy = SendMessage(eWordBreak.hWnd, WM_SETREDRAW, ByVal True, ByVal 0&)
  134. End Sub
  135.