WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Boxes Examples from Users

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Create Edit box in Box

 Keywords:  

Question:

In a dialog window created by the dialog editor there is the possibility to place an Edit Box. Text in such a box can be edited, changed, highlighted and copied to the clipboard etc.

If I create a box by the commands BoxesUp and BoxNew, I wasn't able to find such an option. I can only insert text by BoxDrawText, but this cannot be edited. Or is there some other command which I didn't find yet?

Answer:

No. The box functions only really support the button control, they do not support editboxes perse. If you want graphical dialogs with the ability to add controls, you can use the functions in the HTML Dialog Extender.

OR

A user shared the following sample code, that might help.

;Edit Box in box.
;Modified script of List Box. 

;Define standard window style constants
nWSxCHILD = 16384 << 16
nWSxGROUP = 2 << 16
nWSxTABSTOP = 1 << 16
nWSxVISIBLE = 4096 << 16

;Define ListBox window style constants
nLBSxUSETABSTOPS = 128

;Define extended window style constants
nWSxEXxCLIENTEDGE = 512

AddExtender("WWCTL34I.DLL")

;Create parent box
BoxesUp("296,230,732,453", @NORMAL)
BoxButtonDraw(1, 1, "OK", "660,450,760,300")    
BoxButtonDraw(1, 2, "Exit", "940,450,840,300")
bWho=0

;Set up API call arguments
dwExStyle = nWSxEXxCLIENTEDGE
lpClassName = "Edit"
lpWindowName = 0

dwStyle = nWSxCHILD | nWSxTABSTOP | nWSxVISIBLE 
dwStyle = dwStyle | nLBSxUSETABSTOPS |nWSxGROUP

;Edit Box position
x = 10 ; pixels from left of parent window
y = 30 ; pixesl from top of parent window

;Edit Box dimensions
nWidth = 200 ; pixels
nHeight = 23 ; pixels

hWndParent = DLLhWnd("")
hMenu = 3
hInstance = DLLhInst("")
lParam = 0

;Create the Edit Box
sDLLName = StrCat(DirWindows(1), "User32.DLL")
sEntry = StrCat("long:", '"CreateWindowExA"')

sArgs = "long:dwExStyle"
sArgs = StrCat(sArgs, ", lpstr:lpClassName")
sArgs = StrCat(sArgs, ", long:lpWindowName")
sArgs = StrCat(sArgs, ", long:dwStyle")
sArgs = StrCat(sArgs, ", long:x")
sArgs = StrCat(sArgs, ", long:y")
sArgs = StrCat(sArgs, ", long:nWidth")
sArgs = StrCat(sArgs, ", long:nHeight")
sArgs = StrCat(sArgs, ", long:hWndParent")
sArgs = StrCat(sArgs, ", long:hMenu")
sArgs = StrCat(sArgs, ", long:hInstance")
sArgs = StrCat(sArgs, ", long:lParam")

hWndEdit = DLLCall(sDLLName, %sEntry%, %sArgs%)

:begin
;Set focus on EditBox
cSetFocus(hWndEdit)  

BoxButtonWait()       
for x =1 to 2
        if BoxButtonStat(1,x) then bWho=x
next

Switch bWho
case 1
        ;Get Edit Box content
        text = cGetEditText(hWndEdit)  
        message("Edit Box:",text)
        break
case 2
        exit
        Break
endswitch
goto begin
exit 

Article ID:   W14832
File Created: 2001:11:08:12:40:12
Last Updated: 2001:11:08:12:40:12