I am re-writing all on my scripts to x dialog.
How can I initialize the month array so that the initial selection comes up with a blank or please select.
The very first time that you make a selection it is blank.
select a month
that month stays as the initial selection unitl you close alpha.
Thanks
Charlie Crimmel
code below:
'Date Created: 19-Jun-2008 09:34:11 AM
'Last Updated: 06-Jun-2010 08:15:35 AM
'Created By : ccrimmel
'Updated By : charlie
trace.clear()
'Create an XDialog dialog box to prompt for parameters.
DIM SHARED vmonthname as C
DIM SHARED vmonthno as n
DIM SHARED varC_result as C
DIM SHARED a_dlg_button as C
DELETE a_vmonthname
DIM a_vmonthname[12] as c
dim temp_list as c
dim global okflag as L
var->okflag=.F.
temp_list = <<%list%
January
February
March
April
May
June
July
August
September
October
November
December
%list%
Dim format as p
Format.tab_stops=""
Format.odd_row_color="White"
Format.even_row_color="Blue White"
Format.odd_selected_color="Light Green"
Format.even_selected_color="Light Green"
Format.font="Arial,8"
Format.font_color_unselected="Black"
Format.font_color_selected="Black"
Format.lastbutton="OK"
Format.group_size=1
Format.number_rows=.f.
Format.alternating_bands=.t.
temp_list = a5_owner_draw_list_fmt(temp_list,Format)
a_vmonthname.initialize(temp_list)
heading_string = "Select Month"
dlg_title = "Enter Selection"
heading_string = "Enter Selection"
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
Delete XdialogStyle
dim XDialogStyle as p
XDialogStyle.AccentColor = "White"
XDialogStyle.Color = "#153+204+255"
varC_result = ui_dlg_box(dlg_Title,<<%dlg%
;
{on_key=enter}
Press Enter to advance to next field. When focus is on OK button, Enter will close the dialog;
{lf};
{Windowstyle=Gradient Horizontal Bottom}
{can_exit=exit}
{TOOLCAPTION}
{region}
{text=55,1:heading_string};
{endregion};
{region}
Select Month:| [%v;d;O={@@}%.37vmonthname^=a_vmonthname];
{endregion};
{line=1,0};
{region}
<*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
'-----------------------
%dlg%,<<%code%
if a_dlg_button = "enter" then
if atc("!ok",ui_dlg_ctl_current(dlg_title)) > 0 then
'user is on the OK button, so close the dialog
else
'user is not on the OK button, so advance to next control
ui_dlg_navigate(dlg_title,"Next")
'set a_dlg_button to null to keep the dialog open
a_dlg_button = ""
end if
end if
if a_dlg_button = "Exit" then
var->okflag=.F.
a_dlg_button= ""
end if
%code%)
'-----------------------
SELECT
CASE vmonthname = "January"
vmonthno = 1
CASE vmonthname = "February"
vmonthno = 2
CASE vmonthname = "March"
vmonthno = 3
CASE vmonthname = "April"
vmonthno = 4
CASE vmonthname = "May"
vmonthno = 5
CASE vmonthname = "June"
vmonthno = 6
CASE vmonthname = "July"
vmonthno = 7
CASE vmonthname = "August"
vmonthno = 8
CASE vmonthname = "September"
vmonthno = 9
CASE vmonthname = "October"
vmonthno = 10
CASE vmonthname = "November"
vmonthno = 11
CASE vmonthname = "December"
vmonthno = 12
end SELECT
'-----------------------
if varC_result="OK" then
var->vmonthname= vmonthname
var->okflag=.T.
trace.WriteLn("OK Button Pushed")
trace.WriteLn("Month Name = " + var->vmonthname)
trace.WriteLn("Month Number = " + var->vmonthno)
end if
if varC_result="CANCEL" then
var->okflag=.F.
trace.WriteLn("Cancel Button Pushed")
end if
How can I initialize the month array so that the initial selection comes up with a blank or please select.
The very first time that you make a selection it is blank.
select a month
that month stays as the initial selection unitl you close alpha.
Thanks
Charlie Crimmel
code below:
'Date Created: 19-Jun-2008 09:34:11 AM
'Last Updated: 06-Jun-2010 08:15:35 AM
'Created By : ccrimmel
'Updated By : charlie
trace.clear()
'Create an XDialog dialog box to prompt for parameters.
DIM SHARED vmonthname as C
DIM SHARED vmonthno as n
DIM SHARED varC_result as C
DIM SHARED a_dlg_button as C
DELETE a_vmonthname
DIM a_vmonthname[12] as c
dim temp_list as c
dim global okflag as L
var->okflag=.F.
temp_list = <<%list%
January
February
March
April
May
June
July
August
September
October
November
December
%list%
Dim format as p
Format.tab_stops=""
Format.odd_row_color="White"
Format.even_row_color="Blue White"
Format.odd_selected_color="Light Green"
Format.even_selected_color="Light Green"
Format.font="Arial,8"
Format.font_color_unselected="Black"
Format.font_color_selected="Black"
Format.lastbutton="OK"
Format.group_size=1
Format.number_rows=.f.
Format.alternating_bands=.t.
temp_list = a5_owner_draw_list_fmt(temp_list,Format)
a_vmonthname.initialize(temp_list)
heading_string = "Select Month"
dlg_title = "Enter Selection"
heading_string = "Enter Selection"
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
Delete XdialogStyle
dim XDialogStyle as p
XDialogStyle.AccentColor = "White"
XDialogStyle.Color = "#153+204+255"
varC_result = ui_dlg_box(dlg_Title,<<%dlg%
;
{on_key=enter}
Press Enter to advance to next field. When focus is on OK button, Enter will close the dialog;
{lf};
{Windowstyle=Gradient Horizontal Bottom}
{can_exit=exit}
{TOOLCAPTION}
{region}
{text=55,1:heading_string};
{endregion};
{region}
Select Month:| [%v;d;O={@@}%.37vmonthname^=a_vmonthname];
{endregion};
{line=1,0};
{region}
<*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
'-----------------------
%dlg%,<<%code%
if a_dlg_button = "enter" then
if atc("!ok",ui_dlg_ctl_current(dlg_title)) > 0 then
'user is on the OK button, so close the dialog
else
'user is not on the OK button, so advance to next control
ui_dlg_navigate(dlg_title,"Next")
'set a_dlg_button to null to keep the dialog open
a_dlg_button = ""
end if
end if
if a_dlg_button = "Exit" then
var->okflag=.F.
a_dlg_button= ""
end if
%code%)
'-----------------------
SELECT
CASE vmonthname = "January"
vmonthno = 1
CASE vmonthname = "February"
vmonthno = 2
CASE vmonthname = "March"
vmonthno = 3
CASE vmonthname = "April"
vmonthno = 4
CASE vmonthname = "May"
vmonthno = 5
CASE vmonthname = "June"
vmonthno = 6
CASE vmonthname = "July"
vmonthno = 7
CASE vmonthname = "August"
vmonthno = 8
CASE vmonthname = "September"
vmonthno = 9
CASE vmonthname = "October"
vmonthno = 10
CASE vmonthname = "November"
vmonthno = 11
CASE vmonthname = "December"
vmonthno = 12
end SELECT
'-----------------------
if varC_result="OK" then
var->vmonthname= vmonthname
var->okflag=.T.
trace.WriteLn("OK Button Pushed")
trace.WriteLn("Month Name = " + var->vmonthname)
trace.WriteLn("Month Number = " + var->vmonthno)
end if
if varC_result="CANCEL" then
var->okflag=.F.
trace.WriteLn("Cancel Button Pushed")
end if
Comment