I have a On-Two Option Set having options 1 is for YES and 2 is for NO and there are two pick Lists.
If I say YES, then only first pick List should visible and second one should become invisible and same for opposite. I try to do this but it works for only one time when I select NO after that it remains same independent of what u select.
How to do this???
Use the onChange event of the picklist, and check your code with the Debugging keyword and you will find the problem.
Related
Let me say at outset that I'm using old technology by today's standards! This happens in MFC on Visual Studio 2005 and running under WinXP. (If it 'aint broke.... ;-) )
I have a dialog based app which has a CTabCtrl with two tabs. Each contains a CListCtrl. These work perfectly under normal circumstances. They populate correctly and show and hide as they should. When I first open the application the display selection is correct. If I then minimize the dialog and restore, the CList Ctrl does not show, the tab is blank. It is the only control which has this problem. Another CListCtrl outside of the CTabCtrl does show up correctly. If I then swap tabs and back again, the other tab shows up then the first appears as normal.
This does not happen if I access any other part of the dialog before minimising, it is only when minimising is the absolute first action I take. It also happens with the CListCtrl I have in the other tab if I set this tab to be selected on startup in OnInitDialog where I set up the CTabCtrl.
I have actually solved the effect of this problem by adding into my OnSysCommand(...) the following:
if ((nID & 0xFFF0) == SC_RESTORE)
{
m_ctrlReadList.Invalidate();
}
but it bugs me that I'm adding code to solve a problem which only happens in such odd circumstances. I can't help thinking that there is something I have missed in the setup which is leading to this behaviour. Can anyone offer any explanation as to what is causing it in the first place?
My explanation is based on the facts of what I have found but this has been a learning experience for me so apologies if I get some of it a little confused, I'm still letting it settle in my mind.
Along with this problem I found another which turned out to be relevant. From the nature of the program I'm writing, my CListCtrls needed fixed width headers. Now that turned out to be another thing I couldn't set up! I just needed to prevent the user from grabbing and resizing the header's dividers or double clicking them to autosize, and of course there is functionality in the CListCtrl based on its child CHeaderCtrl to set this up isn't there? Well apparently not. LVS_EX_HEADERDRAGDROP for example isn't the way.
So I explored trying to capture messages which would allow me to myself, and what do you know, I couldn't! I could trap a few but not the ones I needed. I was looking for HDN_BEGINTRACK and HDN_DIVIDERDBLCLICK. (We won't go into the fact that you HAVE TO deal with both A and W versions of those separately!) The CHeaderCtrl is a child of the CListCtrl but it sends its messages back to the CDialog as the CListCtrl's parent. I tried there using both my list's and 0 as ID which headers apparently use. Many of them just plain didn't appear there at all.
So I created my own CListCtrl class inheriting from CListCtrl, overrode OnNotify and they turned up there. I simply prevented CListCtrl::On Notify from being called for those messages and it worked, no resize functionality at all.
I also played with the Z-order too which could have been relevant. I didn't explain earlier but this and another list are on two tabs, exactly aligned over each other. Selecting the tabs HIDEs and SHOWs each of the lists in turn. The other list had no display problems even when I changed the default display in OnInitDialog to show it at start up.
It was under the problematic one. So changing the Z-order in OnInitDialog where I set them up - did nothing! And to rub it in that second list was also unresizeable by default just as I wanted and I couldn't find out why. Their Properties listed exactly the same and there was nowhere in the code where any different aspect was set manually for either, they were effectively theoretically identical, but practically not so. So frustrating!!!
And the upshot of it is that now that the header resize issue is solved my display problem has vanished too! It looks to me and to a few others out there too who report similar symptoms as myself as though the CListCtrl is another one of the slightly flaky ones and needs a little massaging to get the best out of it.
I hope that makes sense to those of you out there who know this control well. I was surprised how simple the solution was, but it also surprised me that the diagnostic process was so difficult. It may of course come down to the ageing system I work within. Nowadays I do this only for fun and the expense of updating VS from 2005 for occasional use is not a high priority. I am sure that some of the symptoms will not show under other build and run environments but it may be worth having the issue and my solution on record somewhere for Google to find for others.
I added 2 commands to my form in lwuit.
form.addCommand(test);
form.setBackCommand(exitCommand);
I changed the command behavior to COMMAND_BEHAVIOR_NATIVE, so i can show the status, and my commands appear at the bottom too, but they appear exit at the right ..and test Command in the middle.
I want to show only 2 commands layout in the menu bar, Exit on the right and options list that contains test on the left.
How can i do that?
First get the back Command and remove it. After this, add the exit Command like a standard Commandwith addCommand. Try this, if this doesn´t work we can try something else.
I don't know about LWUIT since I've never used it, but with native JavaME you sadly have no control of this. It is the individual device that decides where to place the commands.
You can move them around by changing the priority parameter, and you may be able to achieve an acceptable result that way, but only on some devices. The same code will give a different result on other devices.
Do anyone know why FocusOut event is not working on linux?
I have 1 enabled textbox and 3 disabled combobox.
I bind the textbox with FocusOut event where it will call a proc that enables or disables the 3 combobox.
It works perfectly on Windows. However, it doesn't seem to trigger the FocusOut event when this action is done on Linux. One weird thing is that if I click on buttons, FocusOut event seems to be triggered.
Could it be because my combobox are disabled?
But why does it work on Windows?
I really hope someone can help me please.
Thanks in advance.
I have observed in the past that some window managers steal the focus temporarily from Tk on each button click before setting it back; I suspect that this has to do with the way that key event handling works, but I am unable to check at the moment (due to being on OSX, where things are different). Because of the complexities involved, I'd suggest that if you bind to <FocusOut>, you should also check whether you get a <FocusIn> event shortly after; a little extra delay (e.g., 0.1s) before doing the update of the buttons' disabled status will not hurt.
Or you could hang the code to do the disabling off the entry widget validation engine, perhaps like this:
.e configure -validation focusout -validatecommand doButtonEnableDisable
The validation interface is the same for both the old style entry and the new style ttk::entry widgets. It's also supported by spinboxes. Just be aware that you need to return a boolean true from doButtonEnableDisable or you'll reject the change to the entry, and you should take care to ensure that your code does not produce an error or it will disable itself; the docs list the things to watch out for.
I want to move all the private fields in a class to the top or at least to a block where they are gathered together.
Is there any quick way to achieve this with ReSharper?
You want the feature called Cleanup Code.
You can access it via
CTRL+ALT+F, according to my keyboard shortcuts, or
the window menu Resharper | Code | Cleanup code...
Ensure that your profile has the option Reorder members selected. If you want to change the way that the reordering works, you can, but it's a little involved.
You can also apply this across an entire project or the entire solution by right-clicking at the appropriate level in solution explorer and choosing the Cleanup Code... option from there.
I answered a similar question here. It's for putting them at the bottom, but should be enough information to get you set up too.
Have you tried the Clean code options?
I believe you can set the behaviour there.
Kindness,
Dan
while designing my user control, i encountered the following problem:
i would like to set the UserControl.CanGetFocus to false, which is not possible due an error message telling me that a control unable to receive focus can not contain elements who are able to receive focus.
but as i don't want them to actually receive any focus, i would like to disable this for the child-objects as well as for my user control. i can barely believe that there's no possiblity to prevent the child-controls to receive focus, no matter of what type they are? i currently use imageboxes and pictureboxes.
already searched using google, always leading to the result that the property cannot be set to false under these conditions...
If you put the picturebox in a frame and the disable the frame then it will not receive mouse events. Doing this in combination with setting the tabstop to false will prevent the picturebox from receiving focus.
I've used this technique in the past to create a checkbox usercontrol that can be made read-only.
You can set the TabStop property of the childcontrol to False.
Have you tried just using Image controls? If I recall correctly they're lightweight and shouldn't capture focus, whereas a PictureBox is always going to be able (in theory) to capture focus. Depending on your need, this may be sufficient.
Can you set an enabled property to false?
You might want to look at this article.
http://support.microsoft.com/kb/180216
Sounds like you have a problem. The only known workaround is to set the UserControl's Enabled property to False instead of setting the CanGetFocus property. But then, of course you would not be able to respond to clicks and things.
It's been a while, but the solution to this that we used for years was to catch the received-focus event (sorry, can't remember what it is) and then explicitly force th focus to something else. It's kludgey, and not easy (because of the vagaries of event-ordering and reordering in VB/Com Windows), but it got the job done.