how to add toggle box to browser

Posted by Admin on 08-Mar-2009 08:55

hello,

how can i add a toggle box to browser?

Thanks for helping me !!!

All Replies

Posted by Simon de Kraa on 08-Mar-2009 09:28

Add VIEW-AS TOGGLE-BOX to the field definition of the browse.

Posted by Admin on 08-Mar-2009 10:59

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

Posted by Admin on 08-Mar-2009 11:06

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.

Posted by Admin on 08-Mar-2009 11:19

perfect

THANK YOU !!!!!!!

you're the best

kurt

Posted by Admin on 08-Mar-2009 11:23

last question

Now, I can not change the value of the toggle box. How can i enable it?

Kurt

Posted by Admin on 08-Mar-2009 11:27

Thanks for the flowers!

I haven't tried it, but I assume setting hCell:INPUT-VALUE = TRUE or FALSE might to the job.

Posted by Admin on 08-Mar-2009 11:35

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

Posted by Admin on 08-Mar-2009 11:40

Yeah! My mistake.

Try setting the SCREEN-VALUE to "YES" or ENTRY(1,ghBrwCol:FORMAT, "/").

Posted by Admin on 08-Mar-2009 11:48

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, "/").

Posted by Admin on 08-Mar-2009 11:51

You need to set the Screen-value on the browse column, not the buffer field.

ghBrwCol:SCREEN-VALUE = "YES" . /* The value should be quoted */

Posted by Admin on 08-Mar-2009 11:56

Now i receive the error:

not right use of Browse Method SCREEN-VALUE. No records selected (382)

Posted by Admin on 08-Mar-2009 12:01

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.

Posted by Admin on 08-Mar-2009 12:11

i create a brower based on a temp table

i put my code i an attached file

I hope i is enough

thank you

Posted by Admin on 08-Mar-2009 16:01

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.

Posted by Admin on 08-Mar-2009 17:06

Thank you, I solved the problem !!!

Message was edited by:

kurt vandoorne

This thread is closed