PDA

View Full Version : Control and screen focus problems


rctshine
03-24-2005, 01:38 AM
I was using this code to check the length of the string, and if it was equal to five, move on to the next box. but it doesn't work. It never moves on. I tried replacing the "==" with a ">", but that jsut gave me an error that said I was trying to compare a number to a nil value.

I don't know what to do. I put these in the "on Ctrl message" area.


-- These actions are triggered by the controls on the screen.
--find the length of the first entry
local srts1L = String.Length("srts1");
--find the length of the second entry
local srts2L = String.Length("srts2");
--find the length of the third entry
local srts3L = String.Length("srts3");
--check to see when the first five numbers are entered
if(strs1L == 5)then
Screen.SetFocus(CTRL_EDIT_02);
--check to see when the second set of five numbers are entered
if(strs2L == 5)then
Screen.SetFocus(CTRL_EDIT_03);
--because there are no more places to go, don't need to check for the next set.
end
end

Eagle
03-24-2005, 02:23 AM
Hi..have a look at your code..you will see some typo's
..your string variables do not match :yes

csd214
03-24-2005, 03:10 AM
WHEN are these actions executed?

Have a look at Edit Fields Screen | Example 2 in the help doc:
"This action script example illustrates how you can validate the contents of an edit field before proceeding in the install. The above script checks to make sure the first two edit fields on the screen are not empty, and prompts the user for input if they are. As you can see, other types of validation can easily be performed using this type of design"

Darryl's Article: How To Access Screen Input Data (http://www.indigorose.com/forums/showthread.php?t=8906) is another good place to start.

rctshine
03-24-2005, 12:30 PM
Is there a way to restrice the amount of characters that can be entered in a box? I need to restrict a box to five characters, and when the box reaches five, automatically move on to the next box.

Brett
03-24-2005, 01:45 PM
Try the attached screen. Extract the zip file to your C:\Program Files\Setup Factory 7.0\Screens folder and then add it from the gallery. It should get you started.

rctshine
03-24-2005, 03:24 PM
Thanks. Those CTRL functions worked great. But now i have another problem:

I need to take the numbers from the three fields and combine them into one number for checking. I have tried making a table out of the strings, then using Table.Concat. Then I tried just leaving them as strings and using String.Concat.... but nothing seems to work. I always get a "Invalid Serial Number" error.....and I am getting angry/desperate....aaahhhh.....


Here is an example of the table:

-- These actions are performed when the Next button is clicked.

-- get the serial number that the user entered
--get the first part
local strs1 = SessionVar.Expand("%sp1%");
--get the second part
local strs2 = SessionVar.Expand("%sp2%");
--get the third part
local strs3 = SessionVar.Expand("%sp3%");
serial_table = {}
--add the values
Table.Insert(serial_table, 1, strs1);
Table.Insert(serial_table, 2, strs2);
Table.Insert(serial_table, 3, strs3);
--combine the contents of the table into the string
strSerial = Table.Concat(serial_table, "", 1, TABLE_ALL);



Here is an example of the string:

-- get the serial number that the user entered
--get the first part
local strs1 = SessionVar.Expand("%sp1%");
--get the second part
local strs2 = SessionVar.Expand("%sp2%");
--get the third part
local strs3 = SessionVar.Expand("%sp3%");
--Combine the first two strings
strsp1 = String.Concat("strs3", "strs2");
--combine the first two with the third string
strSerial = String.Concat("strsp1", "strs1");

Brett
03-24-2005, 04:39 PM
Try:

-- get the serial number that the user entered
--get the first part
local strs1 = SessionVar.Expand("%sp1%");
--get the second part
local strs2 = SessionVar.Expand("%sp2%");
--get the third part
local strs3 = SessionVar.Expand("%sp3%");

strPassword = strs1..strs2..strs3;

or if you want dashes (or whatever):

strPassword = strs1.."-"..strs2.."-"..strs3;

csd214
03-29-2005, 12:47 PM
Is there a way to restrice the amount of characters that can be entered in a box? I need to restrict a box to five characters, and when the box reaches five, automatically move on to the next box.

The answer is YES, as already demonstrated by Brett with his "Multi Field Serial Number" screen!

rctshine's question inspired me to investigate the possibilities. The event variables e_CtrlID, e_MsgID and e_Details belong to the "heavy stuff" in SU70; at least that is my opinion. I had success; it really is possible "to manage and manipulate this screen at run time" (quote help doc).

Suggestion for the help doc:
Cross reference link between Controls (Controls Types) and Screen Types.

What are the possible notification message ids when working with the Edit Field screen? The answer is MSGID_ONCHANGED. The list box screen has MSGID_CLICKED and MSGID_ONSELCHANGED. A link from Screen Type (the context sensitive help page) to the corresponding control type page should be helpful.

Q#1: I encountered one problem; I had an edit field with the optional button with this code:
if (e_CtrlID == CTRL_EDIT_01) then
SessionVar.Set("%B_EditVar01%","Edit Fields Control.txt");
DlgEditField.SetProperties(CTRL_EDIT_01, {Text = "Edit Fields Control.txt"});
Screen.SetFocus(CTRL_BUTTON_01);
end

The Set Focus command wasn't "good". Focus OK, but the button text disappeares until the cursor is moved over the button. I tried another theme, but the behaviour was identical.

Q#2: The Style Pane, what object is controlled by "Controls Disable Text" (colour)?
I couldn't notice any difference anywhere?

csd214
03-30-2005, 04:40 AM
I found the answer to my first question:

The MSGID_ONCHANGED event is triggered several times when the screen is created (before On Preload). By introducing a Boolean variable (bDisplayCtrMsg) set at the end of 'On Preload', I could temporarily disable the MSGID_ONCHANGED event:

if (e_MsgID == MSGID_ONCHANGED) and (bDisplayCtrMsg) then
if (e_CtrlID == CTRL_EDIT_01) then

bDisplayCtrMsg = false; -- disable the MSGID_ONCHANGED event
SessionVar.Set("%B_EditVar01%","Edit Fields Control.txt");
DlgEditField.SetProperties(CTRL_EDIT_01, {Text = "Edit Fields Control.txt"});
bDisplayCtrMsg = true; -- ensable the MSGID_ONCHANGED event

Screen.SetFocus(CTRL_BUTTON_01);
end
end

With this code the button display is NOT changed.

Still I wonder about Q#2. Can anybody tell me?