Sorry Doug, but this is an perfect example of posting before
testing. Look at the next lines, I added the resize for you,
but on a bit weird place, I presume that you need to resize
the window and the inputtextbox size and not the label, so here's
the right code.
DIALOG NEW 0, windowtext, ,, 160+xtrwi, 70+xtrhi, 0, 0 TO hDlg
' ** Add controls to it
CONTROL ADD LABEL, hDlg, %IDINPPROMPT, prompt, 5, 12, 160, 12, 0
CONTROL ADD TEXTBOX, hDlg, %IDINPTEXT, exampletxt, 5, 24, 160+xtrwi, 12+xtrhi, 0
Herman..
(Bli... probably done to much and to long today)
------------------
Announcement
Collapse
No announcement yet.
Resizing INPUTBOX$
Collapse
X
-
oops little error when compiling, left a lib call
in underneath statement:
'with the function inside the exe's code
DECLARE FUNCTION inpbox LIB ALIAS "inpbox" (BYVAL prompt AS _
STRING,BYVAL windowtext AS STRING,BYVAL exampletxt AS STRING, BYVAL _
extrahigth AS LONG,BYVAL extrawidth AS LONG) AS STRING
should be !!
'with the function inside the exe's code
DECLARE FUNCTION inpbox ALIAS "inpbox" (BYVAL prompt AS _
STRING,BYVAL windowtext AS STRING,BYVAL exampletxt AS STRING, BYVAL _
extrahigth AS LONG,BYVAL extrawidth AS LONG) AS STRING
------------------
Leave a comment:
-
Guest repliedThank you very much for your example code. It'll be a big help!
------------------
Leave a comment:
-
I had this laying around, put some comment to it, so it is easy to use/understand.
As simple examples, mostly do the trick.
Code:' Simple example inputbox that has a dialog and requires absolutely ' no API calls ' syntax var=inpbox(userprompt,dialogtitle,exampletxt,(+-)width,(+-)highth) ' returns "-1" if cancelled, and otherwise it returns the inputstring ' with the width and highth you can play by adding or substracting values. ' by compiling as exe [##compile exe] , you can test it, by compiling as dll ' [ #compile dll ] you can use it by declaring the function in the other ' executable like in the exe example : ' [ declare function inpbox lib "inpbox.dll" alias "inpbox" (BYVAL prompt AS _ ' STRING,BYVAL windowtext AS STRING,BYVAL exampletxt AS STRING, byval _ ' extrahigth AS LONG,byval extrawidth as long) AS STRING ] ' and then do a:: ' inputtext=inpbox("We want you to have input here","This is a inputbox example", _ ' "exampletext",10,100) '============================================================================== '#COMPILE DLL #COMPILE EXE %IDINPOK = 100 %IDINPCANCEL = 102 %IDINPTEXT = 120 %IDINPPROMPT = 121 '------------------------------------------------------------------------------ ' Global variable to receive the inputstring and maybe do something with it GLOBAL inputtext AS STRING 'with the use of a dll ' DECLARE FUNCTION inpbox LIB "inpbox.dll" ALIAS "inpbox" (BYVAL prompt AS _ ' STRING,BYVAL windowtext AS STRING,BYVAL exampletxt AS STRING, BYVAL _ ' extrahigth AS LONG,BYVAL extrawidth AS LONG) AS STRING 'with the function inside the exe's code DECLARE FUNCTION inpbox LIB ALIAS "inpbox" (BYVAL prompt AS _ STRING,BYVAL windowtext AS STRING,BYVAL exampletxt AS STRING, BYVAL _ extrahigth AS LONG,BYVAL extrawidth AS LONG) AS STRING FUNCTION PBMAIN() AS LONG LOCAL inputtext AS STRING inputtext=inpbox("We want you to have input here","This is a inputbox example", _ "exampletext",10,100) IF inputtext="-1" THEN MSGBOX "Input cancelled",,"Inpbox.exe example" ELSE MSGBOX "Input returned :"+inputtext,,"Inpbox.exe example" END IF END FUNCTION '------------------------------------------------------------------------------ CALLBACK FUNCTION OkButton() CONTROL GET TEXT CBHNDL, %IDINPTEXT TO inputtext DIALOG END CBHNDL, 1 END FUNCTION CALLBACK FUNCTION CancelButton() DIALOG END CBHNDL, 0 END FUNCTION '------------------------------------------------------------------------------ FUNCTION inpbox ALIAS "inpbox" (BYVAL prompt AS STRING,BYVAL windowtext AS STRING, _ BYVAL exampletxt AS STRING,BYVAL xtrwi AS LONG, BYVAL xtrhi AS LONG) EXPORT AS STRING $REGISTER NONE LOCAL hDlg AS LONG LOCAL result AS LONG ' ** Create a new dialog template DIALOG NEW 0, windowtext, ,, 260, 70, 0, 0 TO hDlg ' ** Add controls to it CONTROL ADD LABEL, hDlg, %IDINPPROMPT, prompt, 5, 12, 160+xtrwi, 12+xtrhi, 0 CONTROL ADD TEXTBOX, hDlg, %IDINPTEXT, exampletxt, 5, 24, 240, 12, 0 CONTROL ADD BUTTON, hDlg, %IDINPOK, "&OK", 34, 45, 40, 14, &H1& CALL OkButton CONTROL ADD BUTTON, hDlg, %IDINPCANCEL, "&Cancel", 84, 45, 40, 14, 0 CALL CancelButton ' ** Display the dialog DIALOG SHOW MODAL hDlg TO result ' ** Check the result IF result THEN FUNCTION=inputtext ELSE FUNCTION = "-1" END IF END FUNCTION
Leave a comment:
-
There is no way to resize InpuBox$. However, it really is quite easy to create a replacement in the size you need using the DDT functions.
Regards,
Bob Zale
PowerBASIC Inc.
------------------
Leave a comment:
-
Resizing INPUTBOX$
Is there a way to resize an "INPUTBOX$"? For instance, I'd like
to make it wider to accomodate my default answer.
Alternatively, is there a way to display a string so the user
can cut and paste it into another app?
Thank you
------------------
Tags: None
Leave a comment: