hello,
how can i add a toggle box to browser?
Thanks for helping me !!!
Add VIEW-AS TOGGLE-BOX to the field definition of the browse.
my code is:
CREATE BROWSE ghBrowse
ASSIGN
ROW = 4 COL = 2
WIDTH = 108 DOWN = 4
FRAME = ghFrame
QUERY = ghQuery
SENSITIVE = YES
SEPARATORS = YES
ROW-MARKERS = NO
VISIBLE = YES
TRIGGERS:
ON 'VALUE-CHANGED':U PERSISTENT RUN valueChanged IN ghViewer.
END TRIGGERS.
ASSIGN hField = ghTTLevRtBuf:BUFFER-FIELD('lev_nr')
hField:LABEL = "Levcode"
ghBrwCol = ghBrowse:ADD-LIKE-COLUMN(hField)
ghBrwCol:COLUMN-BGCOLOR = 16
ghBrwCol:WIDTH-CHAR = 10
ghBrwCol:READ-ONLY = YES.
ASSIGN hField = ghTTLevRtBuf:BUFFER-FIELD('lev_naam')
hField:FORMAT = 'x(40)'
hField:LABEL = "Leverancier"
ghBrwCol = ghBrowse:ADD-LIKE-COLUMN(hField)
ghBrwCol:COLUMN-BGCOLOR = 16
ghBrwCol:WIDTH-CHAR = 37
ghBrwCol:READ-ONLY = YES.
/I WANT TO ADD A COLUMN WITH A TOGGLE BOX HERE/
How can I do that?
Thanks
Kurt
ghBrwCol = ghBrowse:ADD-LIKE-COLUMN (hField, 3, "TOGGLE-BOX").
should do. The 3 is the column number. 0 might work as well, to create it as the last column.
perfect
THANK YOU !!!!!!!
you're the best
kurt
last question
Now, I can not change the value of the toggle box. How can i enable it?
Kurt
Thanks for the flowers!
I haven't tried it, but I assume setting hCell:INPUT-VALUE = TRUE or FALSE might to the job.
my code:
ASSIGN
hField = ghTTLevRtBuf:BUFFER-FIELD('schrappen')
hField:LABEL = "schrappen?"
hField:INPUT-VALUE = YES
ghBrwCol = ghBrowse:ADD-LIKE-COLUMN(hField,3,"TOGGLE-BOX")
ghBrwCol:COLUMN-BGCOLOR = 16
ghBrwCol:WIDTH-CHAR = 37.
i receive an error - not setable attribute for Buffer-field widget
Yeah! My mistake.
Try setting the SCREEN-VALUE to "YES" or ENTRY(1,ghBrwCol:FORMAT, "/").
ASSIGN
hField = ghTTLevRtBuf:BUFFER-FIELD('schrappen')
hField:LABEL = "schrappen?"
hField:SCREEN-VALUE = YES
ghBrwCol = ghBrowse:ADD-LIKE-COLUMN(hField,3,"TOGGLE-BOX")
ghBrwCol:COLUMN-BGCOLOR = 16
ghBrwCol:WIDTH-CHAR = 37.
i receive same error - not setable attribute for Buffer-field widget
But i don't understand > ENTRY(1,ghBrwCol:FORMAT, "/").
You need to set the Screen-value on the browse column, not the buffer field.
ghBrwCol:SCREEN-VALUE = "YES" . /* The value should be quoted */
Now i receive the error:
not right use of Browse Method SCREEN-VALUE. No records selected (382)
Tell me a little bit more about your scenario?
Sounds like you are manipulating the SCREEN-VALUE without a row in the browse. When there is a logical field in the table shown in the browse, the toggle should be checked and unchecked automatically.
If you need to code it, use the ROW-DISPLAY trigger.
The problem with the ROW-DISPLAY trigger is, that you cannot ask the browse for column handles in the ROW-DISPLAY trigger, so you need to store the handle of the toggle box column after creating it in a handle variable and
ASSIGN hToggleCol:SCREEN-VALUE = "YES".
in the ROW-DISPLAY trigger.
i create a brower based on a temp table
i put my code i an attached file
I hope i is enough
thank you
Ok. I see you code - but I still don't understand what you are trying to do...
There is a temp-table ttHakoSend that probably has some rows. The field Schrappen is logical and displayed as a toggle-box. So usually, the toggle should be checked or unchecked depending on the data in the temp-table. Isn't that happening?
If you wanna change the output, you should add a ROW-DISPLAY trigger to the browse:
Then create a rowDisplay procedure where you should be able to manipulate the SCREEN-VALUE of the browse column/current iteration.
Thank you, I solved the problem !!!
Message was edited by:
kurt vandoorne