Jump to content
Sign in to follow this  
Floppy

$BS_PUSHLIKE option for Checkbox

Recommended Posts

Floppy

Hello, sorry for my bad english, but I'm italian...

I'm wrote the following script, but I receive an error on red line

#include <GuiConstantsEx.au3>

GUICreate("Html Editor",500,500)
GUICtrlCreateEdit("",10,50,480,440)
[color=red]GUICtrlCreateCheckbox("B",10,10,30,30,$BS_PUSHLIKE)[/color]
GUISetState(@SW_SHOW)

While 1
    $m=GUIGetMsg()
    Select
    Case $m=$gui_event_close
        ExitLoop
    EndSelect
WEnd

The log says:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\FSoft\Desktop\Mailer\Html Editor.au3"

C:\Users\FSoft\Desktop\Mailer\Html Editor.au3 (15) : ==> Variable used without being declared.:

GUICtrlCreateCheckbox("B",10,10,30,30,$BS_PUSHLIKE)

GUICtrlCreateCheckbox("B",10,10,30,30,^ ERROR

>Exit code: 1 Time: 0.225

Please, can you help me? Thanks in advance!

Edited by FSoft

Share this post


Link to post
Share on other sites
Jos

#include <ButtonConstants.au3>
#include <GuiConstantsEx.au3>
GUICreate("Html Editor", 500, 500)
GUICtrlCreateEdit("", 10, 50, 480, 440)
GUICtrlCreateCheckbox("B", 10, 10, 30, 30, $BS_PUSHLIKE)
GUISetState(@SW_SHOW)
While 1
    $m = GUIGetMsg()
    Select
        Case $m = $gui_event_close
            ExitLoop
    EndSelect
WEnd

Ciao :)


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Floppy

Another question:

How can I get the selected text in the editbox? I'm tried with _GUICtrlEdit_GetSel($edit), but doesn't work...Can you help me, please?

Share this post


Link to post
Share on other sites
Jos

Another question:

How can I get the selected text in the editbox? I'm tried with _GUICtrlEdit_GetSel($edit), but doesn't work...Can you help me, please?

Have a look at the helpfile how to specify the Control Handle. The example for GUICtrlEdit() shows that.

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
ProgAndy

GetSel returns the startpos and the endpos. You have to get the selection with GUICtrlRead and StringMid:

#include <ButtonConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiEdit.au3>
GUICreate("Html Editor", 500, 500)
$Edit = GUICtrlCreateEdit("", 10, 50, 480, 440)
$btn = GUICtrlCreateButton("GetSel", 100, 10, 90, 30)
GUICtrlCreateCheckbox("B", 10, 10, 30, 30, $BS_PUSHLIKE)
GUISetState(@SW_SHOW)
While 1
    $m = GUIGetMsg()
    Select
        Case $m = $gui_event_close
            ExitLoop
        Case $m = $btn
            $Selection  = _GUICtrlEdit_GetSel($Edit)
            If IsArray($Selection) Then
                $Selection[0] += 1 ; startpos -- getsel is o-based, stringMid 1 based
                $Selection[1] += 1 ; endpos
                $SelLength = $Selection[1]-$Selection[0]
                $text = StringMid(GUICtrlRead($Edit),$Selection[0],$SelLength)
                MsgBox(0, "", $text)
            EndIf
    EndSelect
WEnd

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
Floppy

thank you!!!

Share this post


Link to post
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
Sign in to follow this  

×