Is it possible to have a dop down list in Adobe Livecycle with sub-sections? - livecycle

I want to make a drop down list with sub-sections in Livecycle. For example:
If my drop down gives some one the option of coffee or juice and they choose juice, then it asks what kind of juice.
-Coffee
- black
- sugar
- cream
- sugar & cream
-Juice
- orange
- apple
- grape
Is this possible?

I know you can make additional items like drop downs, text boxes, radio buttons etc. visible when a choice is made from a drop down. So if the user chooses coffee a radio button appears with decaf/regular and check boxes with cream, sugar etc.
The following script is from a form that had paper selection and based on on the paper selected a choice of paper weights available in a drop down became visible.
**This code in java script place in the mouse exit**
if (Paperdropdownlist.rawValue == "Astrobrights") {
Astrobrightweight.presence = "visible";
} else {
Astrobrightweight.presence = "invisible";
}
**this script was in the form ready of the drop down that would become visible**
if (Paperdropdownlist.rawValue == "Astrobrights") {
Astrobrightweight.presence = "visible";
} else {
Astrobrightweight.presence = "invisible";
}

Related

Show translated value to user but save something else in database | Angularjs | Angular-Translate

I am using Anguarjs and trying to translate with $translate
I have a dropdown list where I show translated options to the end-user.
For example, English = "Red" and French = "Rouge", etc.
This has a problem, If a user who speaks French chooses "Rouge" and I want to query the DB for all the "RED" values, I will only get the ones that were chosen in English.
I want to show the translated values to the user when they choose something, but in DB always store a value that is not translated.
(Show something else, save something else [show: "Rouge"] [save: "Value1"])
JS Dropdown values=>
personalityStyles:
[
$translate.instant('CONTACTS.FIERY_RED'),
$translate.instant('CONTACTS.SUNSHINE_YELLOW'),
$translate.instant('CONTACTS.COOL_BLUE'),
$translate.instant('CONTACTS.EARTH_GREEN')
]
Translations (EN)=>
"CONTACTS.FIERY_RED": "Fiery Red (driver) (short-tempered, fast or irritable)",
"CONTACTS.SUNSHINE_YELLOW": "Sunshine Yellow (optimist) (optimistic, active and social)",
"CONTACTS.COOL_BLUE": "Cool Blue (analytic) (analytical, wise and quiet)",
"CONTACTS.EARTH_GREEN": "Earth Green (emphatic) (relaxed and peaceful)",
FR =>
"FIERY_RED": "Rouge ardent (conducteur) (coléreux, rapide ou irritable)",
"SUNSHINE_YELLOW": "Sunshine Yellow (optimiste) (optimiste, actif et social)",
"COOL_BLUE": "Cool Blue (analytique) (analytique, sage et silencieux)",
"EARTH_GREEN": "Terre verte (emphatique) (détendue et paisible)"
Now I don't want to save all this text, I just want to save RED or GREEN, etc. so that I have good data in my DB.
You need to be sending and storing the translation key in the database, not the translated color. The translations themsleves are only a concern for the front end translation service. All other parts of your code should only deal with the translation keys.

How to set nodes in a treeview to start off checked if a checkbox on a previous window is selected

First time Posting on this site. I hope I have the information formatted correctly.
I am designing a simple windows form to help create change control forms to track employee access. It is a 2 part form. The main form asks for some user input and there is a checkbox at the bottom that they can select if they are requesting a standard user setup. When they click next in the main form a child form window pops up that contains a treeview and a comments section for any special notes. What I am trying to do is have some nodes automatically checked if the 'Standard Setup' box is checked in the main form.
When I run the code I get a error stating "Method invocation failed because First[System.Windows.Forms.TreeView] does not contain a method named 'checknode'."
My standard setup box is $checkboxStandardSetup and if it has been checked then I want to have it place a checkbox next to these nodes in the treeview. If it isn't checked no other modification need to be made in the treeview. Here is a snippet of what I have.
if ($checkboxStandardSetup.Checked)
{
$treeview1.checknode("7")
$treeview1.checknode("8")
$treeview1.checknode("9")
$treeview1.checknode("10")
$treeview1.checknode("11")
$treeview1.checknode("12")
$treeview1.checknode("14")
$treeview1.checknode("20")
}
I have also tried to use
if ($checkboxStandardSetup.Checked)
{
$treeview1.node7.checked
$treeview1.node8.checked
$treeview1.node9.checked
$treeview1.node10.checked
$treeview1.node11.checked
$treeview1.node12.checked
$treeview1.node14.checked
$treeview1.node20.checked
}
But to no avail. The function below works to parse through and then output a list of the checked nodes but I can't get the standard setup box to apply those checks.
Function Get-CheckedNodes
{
param (
[ValidateNotNull()]
[System.Windows.Forms.TreeNodeCollection]$NodeCollection,
[ValidateNotNull()]
[System.Collections.ArrayList]$CheckedNodes)
foreach ($Node in $NodeCollection)
{
if ($Node.Checked)
{
[void]$CheckedNodes.Add($Node)
}
Get-CheckedNodes $Node.Nodes $CheckedNodes
}
}
To call the function I use
$checkedNodes = New-Object System.Collections.ArrayList
Get-CheckedNodes $treeview1.Nodes $CheckedNodes
foreach ($node in $CheckedNodes)
{
Write-Output $node.text | Out-File -append C:\Change\UserForm$(Get-Date -Format 'MM-dd-yy').csv
}
I expected the treeview list to have a checkbox next to the nodes that I coded but instead I get the above error. I don't understand what I am doing wrong. Any advice appreciated!

How to capture which treeview node is clicked

I created a tree view controls using WinApi. I want to capture mouse click on checkboxes. The notification message NM_CLICK contains NMHDR, which has no information about the node being clicked. since the clicked node may be different from the selected node, there should be a way to find which node has been checked or unchecked, It could be HTREEITEM, or lParam Inserted when adding items to tree view. I want to capture the checking/unchecking in real time. How can I specify which Node being checked/unchecked? any help or link appreciated.
mr.abzadeh
I want to capture the checking/unchecking in real time. How can I
specify which Node being checked/unchecked?
for this exist notification TVN_ITEMCHANGING and TVN_ITEMCHANGED - look for uStateNew and uStateOld members of NMTVITEMCHANGE - when tree view have checkboxes (TVS_CHECKBOXES style) it used as state image list with 2 images - unchecked and checked.
so state & TVIS_STATEIMAGEMASK will be 0 when no checkbox, INDEXTOSTATEIMAGEMASK(1) for unchecked and INDEXTOSTATEIMAGEMASK(2) for checked. based on this info we can and capture mouse click on checkboxes
by using TVN_ITEMCHANGING you can also prevent the change when you return TRUE for this notification. if you need only notify - use TVN_ITEMCHANGED
case WM_NOTIFY:
{
union {
LPARAM lp;
NMTVITEMCHANGE *pnm;
NMHDR* phdr;
};
lp = lParam;
switch (phdr->code)
{
case TVN_ITEMCHANGING:
{
UINT CheckStateOld = pnm->uStateOld & TVIS_STATEIMAGEMASK;
UINT CheckStateNew = pnm->uStateNew & TVIS_STATEIMAGEMASK;
if (CheckStateNew != CheckStateOld)
{
PCSTR szstate = "??";
switch (CheckStateNew)
{
case INDEXTOSTATEIMAGEMASK(1):
szstate = "uncheck";
break;
case INDEXTOSTATEIMAGEMASK(2):
szstate = "check";
break;
}
DbgPrint("%p>%s\n", pnm->lParam, szstate);
}
}
return FALSE;
}
}
also read How to Work With State Image Indexes
// Image 1 in the tree-view check box image list is the unchecked box.
// Image 2 is the checked box.
tvItem.state = INDEXTOSTATEIMAGEMASK((fCheck ? 2 : 1));
notification TVN_ITEMCHANGING and TVN_ITEMCHANGED is available begin from Windows Vista. if you need XP support too - on xp only option use #IInspectable solution
You can send a TVM_HITTEST message (or use the TreeView_HitTest macro) to find the tree view item, given a client-relative coordinate.
To get the cursor position at the time the NM_CLICK message was generated, use the GetMessagePos API.
This allows you do monitor any mouse click in the client area of the control. If you are interested in the state changes as the result of the standard tree view control implementation, you can handle the TVN_ITEMCHANGING or TVN_ITEMCHANGED notifications instead. Both supply an NMTVITEMCHANGE structure, where the hItem identifies the item being changed, and lParam carries application specific data.

Select all checkbox in Tcl/Tk tablelist header

How to implement a checkbox inside the header of tcl/tk Tablelist for implementing a select all functionality. I have not been able to find any resource . Is it possible in any method? Please guide.
I bypassed the problem as I have not found any direct method to add a widget in tablelist header.
i have used two 16x16 png images (one of a unchecked box ; another checked box ) as the -labelimage which was toggled with the labelcommand.
In this way user have a clue of the action of clicking that box ( actually the whole header ).
Sample code:(not optimized)
package require Tk
package require tablelist
package require Img
namespace eval ::test {
variable toggleState 0
}
proc onClick {tbl col} {
if {$::test::toggleState==0} {
.tbl columnconfigure 0 -labelimage .image.uncheckedbox
## ENTER YOUR CODE HERE TO DESELECT ALL CHECKBOX IN CELL WINDOW OF 0th COLUMN.
set ::test::toggleState 1
} else {
.tbl columnconfigure 0 -labelimage .image.checkedbox
## ENTER YOUR CODE HERE TO SELECT ALL CHECKBOX IN CELL WINDOW OF 0th COLUMN.
set ::test::toggleState 0
}
}
tablelist::tablelist .tbl -columntitles {col1 col2 col3} -height 10 -width 100 -stretch all -stripebackground #e0e8f0
grid .tbl -padx 5 -pady 5 -sticky news
image create photo .image.checkedbox -file {E:\path\checked.png}
image create photo .image.uncheckedbox -file {E:\path\unchecked.png}
.tbl columnconfigure 0 -labelimage .image.uncheckedbox -labelcommand onClick

How could I create a Gantt-like chart in a datawindow (Powerbuilder)

I want a rather simple (and cheap) solution, just for presentation purposes (and just to show the task duration bars - no connection lines between them). So, I am not interested in buying some advanced custom control like this for example. Have any of you ever used something like this? Are there any code samples available?
I would have pointed to Buck Woolley's dwExtreme site for an example of how to do a gantt in native DataWindow. However, "simple" I don't think is in your future if you want to roll your own. In fact, I'll be pleasantly surprised if someone writes a posting that includes a full description; I think it would take pages. (I'd be happy if someone proved me wrong.) In the meantime, here are some DataWindow basics I think you would need:
You can create an external DataWindow whose data source is not tied to a table
Columns in the data set do not have to be shown on the user interface
Columns in the data set can be used in expressions to evaluate attributes, so you could have a column for each of the following attributes of a rectangle:
x
width
color
I'd expect this to be a lot of work and time, and very likely to be worth the purchase the component (unless your time is valued at next to nothing, which in some IT shops is close to true).
Good luck,
Terry
(source: illudium.com)
You can make a simple Gantt chart with a Stacked Bar Graph (BarStacked (5) in the painter). The trick is to create a dummy series to space the bar out where you want it and make the dummy bar the same color as the graph's background (BackColor). It turns out you also need another dummy series with a small value to sit on the axis. Otherwise when you change the color of the bar that's doing the spacing, the axis line gets cut off. I found that .04 works well for this value.
Create the DataWindow
(This assumes familarity with the DataWindow Wizard. Refer to the PowerBuilder User's Guide for more information on creating graphs in DataWindows)
Click the icon for the new object wizard. Create a Graph DataWindow with an External data source. Create columns task type string(20), ser type string(1), and days type number. Set the Category to the task column and the Values to the days column. Click the Series button and select ser for the series. Don't bother with the title, and select the Stacked Bar graph type. When the painter opens, save the DataWindow. On the General tab in the Painter, change the Legend to None (0). On the Axis tab, select the Category axis, then set the sort to Unsorted (0). Select the Value axis then set the sort to Unsorted (0). Select the Series axis and set the sort to Ascending (1). Save the DataWindow.
Create the Window
Create a window and place a DataWindow control, dw_1. Set the data object to your graph DataWindow. Place the following in the open event (or pfc_postopen if using PFC).
try
dw_1.setRedraw(FALSE)
// LOAD DATA HERE
dw_1.object.gr_1.title = 'Project PBL Pusher'
dw_1.object.gr_1.category.label = 'Phase'
dw_1.object.gr_1.values.label = 'Project-Days'
catch (runtimeerror re)
if isvalid(gnv_app.inv_debug) then gnv_app.inv_debug.of_message(re.text) // could do better
finally
dw_1.setRedraw(TRUE)
end try
You would load the data for your chart where the comment says // LOAD DATA HERE
Script the graphcreate Event
Add an new event to dw_1. Select pbm_dwngraphcreate for the Event ID. I like to name these events by removing the pbm_dwn prefix so I use graphcreate. Add the following code to the event.
string ls_series
long li_color
try
li_color=long(dw_1.object.gr_1.backcolor)
// note first series is a dummy with a small value (0.04 seems to work) to keep the line from being hidden
ls_series = dw_1.seriesName("gr_1", 2)
if 0 = len(ls_series) then return // maybe show error message
// will return -1 when you set color same as the graph's backcolor but it sets the color
dw_1.setSeriesStyle("gr_1", ls_series, BackGround!, li_color) // the box
dw_1.setSeriesStyle("gr_1", ls_series, ForeGround!, li_color) // the inside
catch (runtimeerror re)
if isvalid(gnv_app.inv_debug) then gnv_app.inv_debug.of_message(re.text) // could do better
end try
Data for the Graph
Load the data with the categories in the reverse order of what you want. For each Task, insert 3 rows and set the series to a, b, and c, respectively. For series a in each task, set a small value. I used 0.04. You may have to experiment. For series b in each task, set the number of days before start. For series c, set the number of days. Below is the data in the sample DataWindow.
Task Ser Days
---- --- ----
Test a 0.04
Test b 24
Test c 10
Develop a 0.04
Develop b 10
Develop c 14
Design a 0.04
Design b 0
Design c 10
Sample DataWindow
Below is the source for a sample DataWindow in export format. You should be able to import into any version >= PB 10. Copy the code and paste it into a file with an SRD extension, then import it.
HA$PBExportHeader$d_graph.srd
release 10;
datawindow(units=0 timer_interval=0 color=1073741824 processing=3 HTMLDW=no print.printername="" print.documentname="" print.orientation = 1 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=0 color="536870912" )
table(column=(type=char(10) updatewhereclause=yes name=task dbname="task" )
column=(type=char(1) updatewhereclause=yes name=ser dbname="ser" )
column=(type=number updatewhereclause=yes name=days dbname="days" )
)
data("Test","a", 0.04,"Test","b", 24,"Test","c", 10,"Develop","a", 0.04,"Develop","b", 10,"Develop","c", 14,"Design","a", 0.04,"Design","b", 0,"Design","c", 10,)
graph(band=background height="1232" width="2798" graphtype="5" perspective="2" rotation="-20" color="0" backcolor="16777215" shadecolor="8355711" range= 0 border="3" overlappercent="0" spacing="100" plotnulldata="0" elevation="20" depth="100"x="0" y="0" height="1232" width="2798" name=gr_1 visible="1" sizetodisplay=1 series="ser" category="task" values="days" title="Title" title.dispattr.backcolor="553648127" title.dispattr.alignment="2" title.dispattr.autosize="1" title.dispattr.font.charset="0" title.dispattr.font.escapement="0" title.dispattr.font.face="Tahoma" title.dispattr.font.family="2" title.dispattr.font.height="0" title.dispattr.font.italic="0" title.dispattr.font.orientation="0" title.dispattr.font.pitch="2" title.dispattr.font.strikethrough="0" title.dispattr.font.underline="0" title.dispattr.font.weight="700" title.dispattr.format="[general]" title.dispattr.textcolor="0" title.dispattr.displayexpression="title" legend="0" legend.dispattr.backcolor="536870912" legend.dispattr.alignment="0" legend.dispattr.autosize="1" legend.dispattr.font.charset="0" legend.dispattr.font.escapement="0" legend.dispattr.font.face="Tahoma" legend.dispattr.font.family="2" legend.dispattr.font.height="0" legend.dispattr.font.italic="0" legend.dispattr.font.orientation="0" legend.dispattr.font.pitch="2" legend.dispattr.font.strikethrough="0" legend.dispattr.font.underline="0" legend.dispattr.font.weight="400" legend.dispattr.format="[general]" legend.dispattr.textcolor="553648127" legend.dispattr.displayexpression="' '"
series.autoscale="1"
series.displayeverynlabels="0" series.droplines="0" series.frame="1" series.label="(None)" series.majordivisions="0" series.majorgridline="0" series.majortic="3" series.maximumvalue="0" series.minimumvalue="0" series.minordivisions="0" series.minorgridline="0" series.minortic="1" series.originline="1" series.primaryline="1" series.roundto="0" series.roundtounit="0" series.scaletype="1" series.scalevalue="1" series.secondaryline="0" series.shadebackedge="0" series.dispattr.backcolor="536870912" series.dispattr.alignment="0" series.dispattr.autosize="1" series.dispattr.font.charset="0" series.dispattr.font.escapement="0" series.dispattr.font.face="Tahoma" series.dispattr.font.family="2" series.dispattr.font.height="0" series.dispattr.font.italic="0" series.dispattr.font.orientation="0" series.dispattr.font.pitch="2" series.dispattr.font.strikethrough="0" series.dispattr.font.underline="0" series.dispattr.font.weight="400" series.dispattr.format="[general]" series.dispattr.textcolor="0" series.dispattr.displayexpression="series" series.labeldispattr.backcolor="553648127" series.labeldispattr.alignment="2" series.labeldispattr.autosize="1" series.labeldispattr.font.charset="0" series.labeldispattr.font.escapement="0" series.labeldispattr.font.face="Tahoma" series.labeldispattr.font.family="2" series.labeldispattr.font.height="0" series.labeldispattr.font.italic="0" series.labeldispattr.font.orientation="0" series.labeldispattr.font.pitch="2" series.labeldispattr.font.strikethrough="0" series.labeldispattr.font.underline="0" series.labeldispattr.font.weight="400" series.labeldispattr.format="[general]" series.labeldispattr.textcolor="0" series.labeldispattr.displayexpression=" seriesaxislabel" series.sort="1"
category.autoscale="1"
category.displayeverynlabels="0" category.droplines="0" category.frame="1" category.label="(None)" category.majordivisions="0" category.majorgridline="0" category.majortic="3" category.maximumvalue="0" category.minimumvalue="0" category.minordivisions="0" category.minorgridline="0" category.minortic="1" category.originline="0" category.primaryline="1" category.roundto="0" category.roundtounit="0" category.scaletype="1" category.scalevalue="1" category.secondaryline="0" category.shadebackedge="1" category.dispattr.backcolor="556870912" category.dispattr.alignment="1" category.dispattr.autosize="1" category.dispattr.font.charset="0" category.dispattr.font.escapement="0" category.dispattr.font.face="Tahoma" category.dispattr.font.family="2" category.dispattr.font.height="0" category.dispattr.font.italic="0" category.dispattr.font.orientation="0" category.dispattr.font.pitch="2" category.dispattr.font.strikethrough="0" category.dispattr.font.underline="0" category.dispattr.font.weight="400" category.dispattr.format="[general]" category.dispattr.textcolor="0" category.dispattr.displayexpression="category" category.labeldispattr.backcolor="556870912" category.labeldispattr.alignment="2" category.labeldispattr.autosize="1" category.labeldispattr.font.charset="0" category.labeldispattr.font.escapement="900" category.labeldispattr.font.face="Tahoma" category.labeldispattr.font.family="2" category.labeldispattr.font.height="0" category.labeldispattr.font.italic="0" category.labeldispattr.font.orientation="900" category.labeldispattr.font.pitch="2" category.labeldispattr.font.strikethrough="0" category.labeldispattr.font.underline="0" category.labeldispattr.font.weight="400" category.labeldispattr.format="[general]" category.labeldispattr.textcolor="0" category.labeldispattr.displayexpression="categoryaxislabel" category.sort="0"
values.autoscale="1"
values.displayeverynlabels="0" values.droplines="0" values.frame="1" values.label="(None)" values.majordivisions="0" values.majorgridline="0" values.majortic="3" values.maximumvalue="1500" values.minimumvalue="0" values.minordivisions="0" values.minorgridline="0" values.minortic="1" values.originline="1" values.primaryline="1" values.roundto="0" values.roundtounit="0" values.scaletype="1" values.scalevalue="1" values.secondaryline="0" values.shadebackedge="0" values.dispattr.backcolor="556870912" values.dispattr.alignment="2" values.dispattr.autosize="1" values.dispattr.font.charset="0" values.dispattr.font.escapement="0" values.dispattr.font.face="Tahoma" values.dispattr.font.family="2" values.dispattr.font.height="0" values.dispattr.font.italic="0" values.dispattr.font.orientation="0" values.dispattr.font.pitch="2" values.dispattr.font.strikethrough="0" values.dispattr.font.underline="0" values.dispattr.font.weight="400" values.dispattr.format="[General]" values.dispattr.textcolor="0" values.dispattr.displayexpression="value" values.labeldispattr.backcolor="553648127" values.labeldispattr.alignment="2" values.labeldispattr.autosize="1" values.labeldispattr.font.charset="0" values.labeldispattr.font.escapement="0" values.labeldispattr.font.face="Tahoma" values.labeldispattr.font.family="2" values.labeldispattr.font.height="0" values.labeldispattr.font.italic="0" values.labeldispattr.font.orientation="0" values.labeldispattr.font.pitch="2" values.labeldispattr.font.strikethrough="0" values.labeldispattr.font.underline="0" values.labeldispattr.font.weight="700" values.labeldispattr.format="[general]" values.labeldispattr.textcolor="0" values.labeldispattr.displayexpression="valuesaxislabel" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )
xhtmlgen() cssgen(sessionspecific="0" )
xmlgen(inline="0" )
xsltgen()
jsgen()
export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )
import.xml()
export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )
export.xhtml()

Resources