Greetings Sybase Community,
I am still a bit new to Powerbuilder, and coding in
general, and would like to ask some assistance. I am
attempting to create a calendar. Here is what I have done so
far, and the problems I am having.
-I created a table with just two columns; month and year.
-On the Datawindow, I made 35 square blocks, to simulate
the look of a calendar and placed a text block on each of
them.
-I made the two column's (Month and Year) drop down
lists, so that when I user selects them I can access the
entered value numerically.
-I then made a window and dragged the datawindow into it.
For now, I added a button in order to use the 'Clicked'
script, but will probably change the initialization once the
script itself is working.
-Here is what I have for the clicked script:
------------------------------------------
////Generate Month
Long Day_i, NextDay_i, Year_i, Month_i, row_i
String Date_i, DayName_i, mod_script_i
////Get Column Values
row_i = dw_1.getRow()
dw_1.setcolumn("dayname_c")
DayName_i = dw_1.getText()
dw_1.AcceptText()
messagebox("Day Name = ", DayName_i)
-------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"Dayname_c" is a computed field on the datawindow with the following computation:
-------------------------------------------
dayname(date(String(year) +" -"+ String( month) +"-01"))
-------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I added the Messagebox to help me debug my progress. So far, it only returns the number for the month (2 for Feb, 3 for March), instead of the dayname that it is supposed to return.
However, when I test it in the Datawindow, the computed field works and displays correctly.
Once I get the above working, hopefully with some help, then I need change the text blocks on the datawindow to display the correct first day of the month:
---------------------------------------------
//if DayName_i = "Sunday" then
// // cell1 = "1"
//w_open_appointments.dw_1.Modify("cell1.text= 1" )
// Day_i = 2
//
//elseif DayName_i = "Monday" then
//// cell2 = "1"
//w_open_appointments.dw_1.Modify("cell2.text= 1" )
// Day_i = 3
---------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^(etc for all 7 days)
"Cell*.text" refers to the names of the text blocks on the datawindow.
Then after that, I want to create the rest of the month:
--------------------------------------------
//NextDay_i = 2
//While cell[Day_i] < 32
// cell[Day_i] = String(NextDay_i)
// Day_i = Day_i+1;
// NextDay_i = NextDay_i+1;
//
-------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I know this loop is done incorrectly. I have some experience in Java, but as aforementioned I'm new to PB. I typed this quickly last night to give me a reference to work by.
But first things first. I The top code isn't working ^^.
Any assistance would be very much appreciated.
I am still a bit new to Powerbuilder, and coding in
general, and would like to ask some assistance. I am
attempting to create a calendar. Here is what I have done so
far, and the problems I am having.
-I created a table with just two columns; month and year.
-On the Datawindow, I made 35 square blocks, to simulate
the look of a calendar and placed a text block on each of
them.
-I made the two column's (Month and Year) drop down
lists, so that when I user selects them I can access the
entered value numerically.
-I then made a window and dragged the datawindow into it.
For now, I added a button in order to use the 'Clicked'
script, but will probably change the initialization once the
script itself is working.
-Here is what I have for the clicked script:
------------------------------------------
////Generate Month
Long Day_i, NextDay_i, Year_i, Month_i, row_i
String Date_i, DayName_i, mod_script_i
////Get Column Values
row_i = dw_1.getRow()
dw_1.setcolumn("dayname_c")
DayName_i = dw_1.getText()
dw_1.AcceptText()
messagebox("Day Name = ", DayName_i)
-------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"Dayname_c" is a computed field on the datawindow with the following computation:
-------------------------------------------
dayname(date(String(year) +" -"+ String( month) +"-01"))
-------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I added the Messagebox to help me debug my progress. So far, it only returns the number for the month (2 for Feb, 3 for March), instead of the dayname that it is supposed to return.
However, when I test it in the Datawindow, the computed field works and displays correctly.
Once I get the above working, hopefully with some help, then I need change the text blocks on the datawindow to display the correct first day of the month:
---------------------------------------------
//if DayName_i = "Sunday" then
// // cell1 = "1"
//w_open_appointments.dw_1.Modify("cell1.text= 1" )
// Day_i = 2
//
//elseif DayName_i = "Monday" then
//// cell2 = "1"
//w_open_appointments.dw_1.Modify("cell2.text= 1" )
// Day_i = 3
---------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^(etc for all 7 days)
"Cell*.text" refers to the names of the text blocks on the datawindow.
Then after that, I want to create the rest of the month:
--------------------------------------------
//NextDay_i = 2
//While cell[Day_i] < 32
// cell[Day_i] = String(NextDay_i)
// Day_i = Day_i+1;
// NextDay_i = NextDay_i+1;
//
-------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I know this loop is done incorrectly. I have some experience in Java, but as aforementioned I'm new to PB. I typed this quickly last night to give me a reference to work by.
But first things first. I The top code isn't working ^^.
Any assistance would be very much appreciated.