I've been following YouTube tutorials most of the day now and I think I've got the basic hang of forms. I'm aiming to create something like this below, which checks a users password and shows how strong it is:
This is what I have at the moment:
I'd like to know the basic theory behind how the top form works, specifically how I can take the user input of password in my form and just get it to print and update in realtime underneath below. I'm not quite sure what tool is used to do that, or for that matter what tool is used to create the colour changing box.
Any help or direction is appreciated, thanks!
Add a keyboardListener to your jtextfield. When a key is pressed get the text and do your stuff(figure out the strength, number of Uppercase etc)
Is this win32 or mfc forms, or some other tech like Qt or wxWidgets?
In both cases you will want to handle messages from the edit field as text is changed in it. This message is the EN_CHANGE message. Handle that message and you can get the text from the edit field and send messages to the strength form to tell it to change its color and text.
Add a System::Windows::Forms::KeyPressEventHandler (or similar) to the TextBox. When raised, do whatever analysis you need to do on the string and update the table below. The color changing box can be one of many implementations. It can be something as simple as a panel that changes its background with a System::Windows::Forms::Label positioned on top of it. It actually looks like that, as the text is not centered.
Related
I am not very experienced with Qt and I have trouble doing what I want.
In my application, I search for archive files with password on a disk (that part works) and I want to ask the user for the password each time I find one new encrypted archive.
If I find multiple files while user hasn't given any password, I want the dialog for the first password to stay visible until that password is given and then the dialog for the next password can show and so on.
I use some sort of queue to remember which archives need a password, and I am trying to show and hide an unique dialog (actually a Popup) with the info of each archive and get the password from a TextField inside. In the meantime my application is doing other stuff in the c++ code like searching for archives and extracting them when a given password is OK.
My problem is that it is not really working. The dialog shows the first time, I get the first password but then the dialog doesn't show for the next password. Sometimes I can see the dialog a second time, for a few milliseconds, before it disappears without user interaction. My application is blocked because it cannot go on without the unasked passwords.
I get that I am doing something wrong but I don't get what exactly.
Can anyone help ?
I don't know if I was very clear, English is (obviously) not my mother tongue.
I found my mistake.
I did a component based on a Popup.
Inside the onClicked function of the Check or Skip buttons I was doing two things: send accepted() or refused() to trigger custom actions and then close the dialog.
I was doing that in that order, so the accepted or refused action, which among others things triggered the visibility for the "next" password dialog, occurred before the close event, which was setting the dialog visibility to false.
I switched the order and it's way better.
I feel a little silly now but at least I found it.
INTRODUCTION AND RELEVANT INFORMATION:
I am maintaining an old application and I need to implement feature that generates reports based on data calculated from a database. User must also have an additional option of printing the file ( user must be able to choose printer, and must be able to see print preview ).
To improve my chances of getting satisfactory answer, allow me to additionally clarify matters with a small "example":
User presses a button -> application calculates data; // Done
Application creates file and populates it with the result; // Done
User gets informed that report is generated; // Done
User presses another button that is charged for printing; // Stuck here!
Print preview pops up and an option to run print dialog. // Stuck here
User starts the print dialog, chooses the printer and application prints the file;
The application is coded in C++ using raw WinAPI ( no MFC ). I am working on Windows XP.
PROBLEM:
I was able to successfully use OLE Automation to generate/save Word and Excel reports but I can not create print preview that matches exactly the print preview Word would create.
If I use OLE Automation to show Excel's print dialog/print preview, there is a following problem that might occur :
User can simply click "Close Print Preview", or can simply close print property sheet ( please see picture below ) and return to the document which might compromise document's data.
My employers do not like this ( they have no software engineering / developing background, so no matter what I say it will end up as an "echo in the wind"... ) and they wish that my print preview matches exactly the print preview Word generates.
Therefore, I need a solution for generating a print preview for the user, in a way that matches exactly print preview Word would create. Furthermore, user should be able only to see how this looks like, but not to be able to open the file from my application. User should be able to choose the printer that will print the file.
An implementation similar to the one from the picture would be fine.
QUESTION:
INTRODUCTORY NOTES:
The question is too broad to be answered in one post so I must limit myself only for seeking advice / general concept / pointing in the right direction.
THE ACTUAL QUESTIONS :
I did the best I could with the OLE Automation and Excel / Word files, but as you can see there are problems with generating a print preview, hence the following questions :
Since this is my first time to tackle this kind of task, can you recommend me the proper way to handle it ( general concepts of course )?
Is there a chance that there is a workaround for my printing problem ( like sending WM_PRINTCLIENT message to the Word / Excel or something like that )?
REMARKS :
Again, I realize the question is too broad so just give me general concepts / pointers, so I could post separate questions if I get stuck somewhere in the way.
I do not need to use Word / Excel and OLE Automation, it was my choice at the moment.
If you can recommend better solution I will gladly accept. I do not wish to use libraries.
If additional information is required, ask and I will edit my post.
You would need to bring up a dialog box when the user clicks the print button, the dialog box would contain a control that shows the preview for the default printer and three buttons to select another printer, print and exit.
The preview control could be a static control where the WM_PAINT handler would draw the preview (alternatives: a Web Browser control which is fed html text or a RichText control which is fed RTF text, but then you are constrained by the functionality of these controls).
Quote: Print preview
isn't that special. It just means that you have to render to screen
(or bitmap) what you'd otherwise would render to the printer DC. This
primarly means using the page size, and providing a UI control for the
prev/next page.
This SO Answer describes in detail the work you need to do to paint the preview.
This CodeProject article has some simple code for print-preview; it's in simple MFC which should not be too difficult to translate to plain C++/WinAPI.
When the user clicks the OK or APPLY button on a property sheet and the program determines data on some page is invalid, how can I cause the page containing the error to be displayed along with a message box describing the error?
Currently the procedure doing the validation does the following while processing the PSN_APPLY notification.
MessageBox (hDlg, "Data must be positive!", "Error", MB_OK);
SetWindowLong (hDlg, DWL_MSGRESULT, PSNRET_INVALID);
This works ok if the page doing the validation (A) is currently displayed but if some other page (B) is being displayed, the message box appears with that page (B) being displayed, then when the message box is answered, the page with the validation error (A) is displayed. I thought about setting some flag so that when that page (A) gets the PSN_SETACTIVE notification it displays the message box but that seems kind of hokey.
Win32 API in c++, no MFC, no NET, nothing fancy.
I think the problem is in the design of your validation and it's presentation.
Am I right in thinking that you iterate through your property sheets, validate them and display a message box if something is awry? Because of course, what you have witnessed will happen, if I am on property page 3 and I wrote crap in to a field on property page 1.
The easiest solution is, when validating, note which property page the field in question is, and set that one active if the user has written crap in to one of your fields. This seems the fastest way possible.
Also, rather than spring up an annoying message box, reserve some room beneath the property pages to display a textual (red or otherwise) warning as to why, and then change to the appropriate property page, and highlight the offending control. Your validation routine can do this nice and easily as it loops through.
Even better, don't stop at the first error. One thing I HATE is correcting one field that I think is the only issue, only to be told every time I hit "OK" or "SUBMIT" that there's something else I missed.
I seriously think you should consider going the extra mile here... loop through ALL controls, and add all invalid ones to a list. Then change each offending control's background colour, tab colour etc... Then the user can work through and correct, no matter how many errors he or she made.
I have a question regarding a platform I'm developing called e-cidadania (GPL). One of the applications will be something like a blackboard where you can put messages. I've been requested to do it like a cartesian grid (p.e. x = good/bad, y = expensive/cheap). My question is, does anybody know about an application like that for django? Or in case that there isn't, how can I do it? I have no idea where to start.
I'll explain a use case, if someone didn't understand: You are in a classroom, the teacher draws on the blackboard the axis and tells the students to write a note. After that every student will put his note according to the axis.
I am not sure if I completely understand your question, but if I'm correct you want the user to input text (name of restaurant or something like that) and instead of showing 2 sliders or dropdown boxes for rating and price, you want to show a cartesian chart where the user can click somewhere, thus entering the 2 values with one click.
This has nothing to do with Django or Python, this is pure client side. Think javascript. One way is to show an image with the cartesian grid, set an onclick handler and see where in the image the click was made. Showing the selected point could be done simply by setting a colored div with an absolute position (relative on the position of the image).
I don't know any plug-and-play solutions, but building this shouldn't be too hard.
On a separate note: I doubt this will actually be more userfriendly for the user then simply using two sliders.
Update:
Or if you want to show a big cartesian chart where the user actually has to input the text on the correct position, this can be done with the same idea: create the text-input, but hide it (display:none). Then when the user clicks somewhere on the chart, move the text-input to the correct position and show it.
This may be a little far fetched, but instead of doing this with django alone, why dont u do this client side using javascript?
Hear me out here.
The highcharts graphing plugin has an option that allows u to add points on a (cartesian) graph. Check this example. The plugin also allows you to display custom messages when hovering on points, so you could use that to display the actual message, and you could handle the actual saving of the new message by submitting the newly added message via Ajax.
I have provided a screenshot of my
CredentialProvider window. In this
window everything is fine now but i
don't want to show Switch User
button to the user. How i can do
this. I am just editing Win-7 SDK
sample for CredentialProvider
(C++). Anyone can help me, or any
link for code help.
One more thing I want to ask is by default, the username text box displaying EditText in grey color. How i could change it to Username text. I can set text in SHStrDupW(L"", &_rgFieldStrings[SFI_EDIT_TEXT]); code but its not setting in background text. is there any hack for this.
Thanks SO members
You cannot directly prevent the Switch User button from appearing; if the conditions are present that cause it to appear, then it's going to appear. What you can do however: prevent the conditions that cause it to appear.
That button appears either when a tile is in the selected state and 1.) your credential provider is enumerating tiles other than the one that is selected, or 2.) other credential providers are enumerating tiles.
The first condition is easy to prevent: In GetCredentialCount(), always report that you will enumerate only one credential. (This means of course that you must structure the tile to handle all users.)
To prevent the second condition, you will have to implement a credential provider filter. (Search for the "ICredentialProviderFilter" interface if you don't know what that is.)
Good luck.
To answer question 2:
The username text box is displaying EditText in grey color. You can change it to Username text. You set text using
SHStrDupW(L"", &_rgFieldStrings[SFI_EDIT_TEXT]);
Have a look at common.h, there you'll find
CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR s_rgCredProvFieldDescriptors[] = { SFI_EDIT_TEXT, CPFT_EDIT_TEXT, L"Edit Text" }
If you change this Edit Text to UserName then it will show in your Text Box.