Jump to content

How to Make Ruler Guidelines


Recommended Posts

If you mean something like Notepad's Word-Wrap, then try using this when making an edit control: BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL)

;) If you mean something like Rulers drawn in MS-Word's Edit Control, then I am sorry, I have no idea.

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

:bye: Hey there, was I helpful?

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

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Link to comment
Share on other sites

Try this:

;coded by UEZ 2012
#include <GuiEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$hGUI = GUICreate("Test GUI", 615, 438, -1, -1)
$idEdit= GUICtrlCreateEdit("", 32, 72, 553, 337, BitOR($ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
$hEdit = GUICtrlGetHandle($idEdit)
GUICtrlSetData(-1, "Edit1")
GUICtrlSetFont(-1, 16, 400, 0, "Times New Roman")
$iChars = 10
$idLabel = GUICtrlCreateLabel("Automatic line break after " & $iChars & " chars", 32, 16, 388, 35)
GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman")
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIRegisterMsg($WM_COMMAND, "")
            Exit
    EndSwitch
WEnd

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $lParam
    Switch BitAND($wParam, 0x0000FFFF)
        Case $idEdit
            If StringLen(_GUICtrlEdit_GetLine($hEdit, _GUICtrlEdit_LineFromChar($hEdit))) > $iChars - 1 Then
                _GUICtrlEdit_AppendText($hEdit, @CRLF)
            EndIf
    EndSwitch
    Return "GUI_RUNDEFMSG"
EndFunc

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Try this:

;coded by UEZ 2012
#include <GuiEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$hGUI = GUICreate("Test GUI", 615, 438, -1, -1)
$idEdit= GUICtrlCreateEdit("", 32, 72, 553, 337, BitOR($ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
$hEdit = GUICtrlGetHandle($idEdit)
GUICtrlSetData(-1, "Edit1")
GUICtrlSetFont(-1, 16, 400, 0, "Times New Roman")
$iChars = 10
$idLabel = GUICtrlCreateLabel("Automatic line break after " & $iChars & " chars", 32, 16, 388, 35)
GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman")
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIRegisterMsg($WM_COMMAND, "")
            Exit
    EndSwitch
WEnd

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $lParam
    Switch BitAND($wParam, 0x0000FFFF)
        Case $idEdit
            If StringLen(_GUICtrlEdit_GetLine($hEdit, _GUICtrlEdit_LineFromChar($hEdit))) > $iChars - 1 Then
                _GUICtrlEdit_AppendText($hEdit, @CRLF)
            EndIf
    EndSwitch
    Return "GUI_RUNDEFMSG"
EndFunc

Br,

UEZ

This does not seem to work.......

If you mean something like Notepad's Word-Wrap, then try using this when making an edit control: BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL)

;) If you mean something like Rulers drawn in MS-Word's Edit Control, then I am sorry, I have no idea.

Yeah1 That is what I mean, but how do I implement it?
Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list]
Link to comment
Share on other sites

You mean something like this here?

;coded by UEZ 2012
#include <guiedit.au3>
#include <guiconstantsex.au3>
#include <windowsconstants.au3>


$hGUI = GUICreate("Test GUI", 615, 438, -1, -1, $WS_SIZEBOX)
$idEdit= GUICtrlCreateEdit("", 32, 72, 553, 337, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$hEdit = GUICtrlGetHandle($idEdit)
GUICtrlSetData(-1, "This is the 1st line in the edit control.")
GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman")
$iChars = 10
$idLabel = GUICtrlCreateLabel("Resize window to wrap text in edit control", 32, 16, 388, 35)
GUICtrlSetFont(-1, 20, 400, 0, "Times New Roman")
GUISetState(@SW_SHOW)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

If I create an edit, how do I limit the amount of text put in one line before it automatically goes to the next one?

You have to be more precise with you issue otherwise there is a lot of room for interpretations...

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...