PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Haakon Birkeland on September 21, 2006, 07:48:30 AM

Title: Input Box
Post by: Haakon Birkeland on September 21, 2006, 07:48:30 AM
Good Morning

How would you go about creating an inputbox?
The one in PB is really not very good looking.
Is there any way besides designing a new form and use a form show command that will work?

Bert
Title: Input Box
Post by: TechSupport on September 21, 2006, 08:29:17 AM
Not that I know of....

If you need an input box for many general purposes then I would advise creating your own Form.
8)
Title: Input Box
Post by: Haakon Birkeland on September 21, 2006, 03:13:42 PM
Here from poff

CALLBACK FUNCTION ipb_cb
STATIC lpText AS ASCIIZ PTR

SELECT CASE CBMSG
CASE %WM_USER+1 : lpText = CBWPARAM
CASE %WM_COMMAND
SELECT CASE LOWRD(CBWPARAM)
CASE 1
CONTROL GET TEXT CBHNDL, 3 TO @lpTEXT
DIALOG END CBHNDL, %true
CASE 2 : DIALOG END CBHNDL, %False
END SELECT
END SELECT
END FUNCTION

FUNCTION inputbox(BYVAL hWndOwner AS LONG, BYVAL Caption AS STRING, BYVAL ButtonYes AS STRING, BYVAL ButtonNo AS STRING ) AS STRING
LOCAL hDlg AS LONG, _
result AS LONG, _
User AS ASCIIZ * 80

DIALOG NEW hWndOwner, Caption, ,, 160, 65, %WS_THICKFRAME TO hDlg
CONTROL ADD TEXTBOX, hDlg, 3, "", 14, 12, 134, 12, 0
CONTROL ADD BUTTON, hDlg, 1, ButtonYes, 34, 32, 40, 14, 1
CONTROL ADD BUTTON, hDlg, 2, ButtonNo, 84, 32, 40, 14
'' set pointer for return string in callback function
CallWindowProc CODEPTR(ipb_cb), hDlg, %WM_USER+1, VARPTR(user), 0
DIALOG SHOW MODAL hDlg CALL ipb_cb TO result

IF result THEN FUNCTION = User

END FUNCTION


Sorry to be lazy but I looked for an easy way out. I found and tried this code and it seems to work properly in 2 of programs I wrote. But it is DDT can that create problem for me in the future

Bert
Title: Input Box
Post by: John Montenigro on October 02, 2006, 01:28:30 PM
Michael Mattias had posted code for something similar on the PB Source Code Forum awhile ago. Search the forum or POFFS.

I think it was called something like "GenericMessageBox"...

-John