We help IT Professionals succeed at work.

Enable/Disable buttons on datawindow.

Rah082800
Rah082800 asked
on
I want to set a datawindow to read only yet keep the buttons that are on that datawindow enabled.  When you set the datawindow to read only it appears to disable all events associated with that datawindow.  Short of moving the buttons to the window and doing quite a bit of coding, I wonder if there is an easier way.
Comment
Watch Question

Commented:
Hallo Rah,

The easiest way, do it in the properties of the Button in datawindow and launch the Expression tab properties as action etc. This may brings some positive results.

If you want to disable the contents of the datawindow except "Button" then set the taborder for column to 0.
Datawindow is read only and Button is enabled.

It is better to use SetTabOrder(column_number, tabnumber) function to set the tab order to 0
dw_1.SetTabOrder(1,0)

Or just FOR loop.

FOR li_count = 1 TO 6 //Say you have 6 columns
    dw_1.SetTabOrder(ll_count, 0)
NEXT

Again when you need, you can set the taborder from 10 t 60.

Or explain further your question what exactlly you are looking for.


Please let me know the result of this test.

THANKS


Bhatti

Commented:
Hi,

Me again.

If your datawindow is read only parmanently, then set the taborder to 0 for all columns. In datawindow painter menu Design--> taborders.

Thanks.

Bhatti

Commented:
Hallo Rah,

I checked and did not find any function or property that can disable the datawindow button. There may exist some trick, but I did not find.

I am looking for how to disable a button(datawindow control) in datawindow.


Bhatti

Commented:
Hi Rah,

You can also use an datawindow expression to check if the DW is readonly and if it is, just make the button invisible.

If you paste this expression in the button's 'Visible' expression editor it might do the trick:

if (describe("DataWindow.ReadOnly") = "yes", 0, 1)

Cheers,
Alex

Commented:
oops! clicked the Answer radiobutton. I'm sorry: it was meant as a comment.

Commented:
Hallo Rah,

May be some trick exist to Enable/Disable the button control of Datawindow, But I find no properties for the Button control of Datawindow. There may we can adjust through the "SuppressEventProcessing" property.
Can you please let me know which action you want to Enabled and which disable.


THANKS


Bhatti

Author

Commented:

Commented:

Author

Commented:
Trouble responding to comments.  This solution works and is in fact the way I had already solved the problem.  I was wondering if anyone knew of another method, however, it seems that this is the only solution.
To Alex, I want the buttons to be visible and useable all the time even if the datawindow is set to readonly.

Commented:
Hallo Rah,

Again me, I have another solution, I found it just few days before. Do the following,

(Just make your datawindow button unvisible)
Place your datawindowcontrol  in the Window and select datawindow for the datawindowcontrol.
Now select a Button control from the window controls and place it to the window.
Now move the button with the help of mouse to the place in datawindow where you want to place it.
In this window button control write your script for you datawindow.

If you will write dw_1.Enabled = FALSE your Button will always Enable.

Try it and let me know please.

Thanks.

Bhatti