I want to use tab key to make four spaces in django textarea? - django

in django textarea, it need four spaces to highlight.
i want to use a tab to replace it .
but it jumps to another tags,
I wonder if there is any solution to it.

That would require a JavaScript widget that captures the input event. What happens when a key is pressed is up to the browser (that is, totally out of your control), so without writing a key capturing widget of your own the default behavior (that is, "move to next control") is what will happen.
It is useful to keep in mind that the web is not actually an application platform (its a document publication platform) and browsers are not actually window managers (they are document viewers).

Related

how to add tab character into test string section of regex101.com

I am using regex101.com to learn regex.
There will be cases where I want to insert a Tab character within the TEST STRING field of regex101.com.
However, when I have the TEST STRING field selected and press the tab key on my keyboard, it doesn't enter the tab character within the TEST STRING field, but rather it just moves me on to the next selectable feature within the browser page.
I note I have done a bit of googling but so far haven't been able to find the answer to how to add a tab character within the TEST STRING field. Although I know for sure it is possible to do this given that I have seen a few videos where the presenter successfully adds a tab character into the field.
I note that I am using Windows 10 and my browser is Google Chrome.
Would greatly appreciate if anyone could provide an answer to this.
Appears regex101 can enable the tab key to be translated by the editors
instead of being pass-through to the system where it changes focus to the
next control in the tab order.
Just uncheck the box in Settings .
Apparently preference gets saved in your browser session cookies.
Typing a Tab into a text editor and copy-pasting (Ctrl + c / Ctrl + v) it into the browser form is an easy solution. Just make sure your editor is not configured to auto-replace tabs with spaces.
Another way would be using a keyboard combination to enter the ASCII or Unicode character code (see this superuser post). For Windows, that should be Alt+ 0 + 9 (Note: apparently the numbers need to be entered on the numpad).
Finally, depending on the browser you use, there might be browser extensions that facilitate what you want. There used to be one called Tabinta for Firefox and one for Chrome called chrome-textarea-formatter, but I believe neither of them is still maintained.

CListCtrl search by typing: how to show what's been typed?

I have a CListCtrl in Report view, and I noticed that I can search by typing the first few letters of an item (the control selects the first item that matches as I type), and that this search "resets" after a second or so (so if I've typed "abc", pause, then type "d", then it searches for "d" only). For usability, I want the user to realize that this search-by-typing feature exists.
So here are the options I can think of, in order of preference, and the question I have in each case:
Use whatever existing built-in support there is in MFC.
Is there such a thing?
Some other solution that's been implemented before.
Again, is there such a thing?
Add another textbox to the dialog box, and handle its ON_EN_CHANGE message to somehow trigger CListCtrl's search behavior. In other words, similar to the find dialog/toolbar in browsers.
How do I trigger the search behavior?
Did take a look into the List-View controls documentation on Microsoft Docs.
This behavior is described in the Default List-View Message Processing (WM_CHAR message). The search-string is indeed reset after one second.
However, I didn't find any notification message that seems to be relative, eg returning the current search-string, which you can display. There is the
LVN_INCREMENTALSEARCH, but the documentation is rather confusing (eg what is an "incremental search"? etc), and I don't know if you are going to receive this at all, as this seems to be about Virtual List-View controls. Anyway, you can give it a try.
But resetting the test entered by the user in just 1 sec may rather be unwelcome to users or reviewers (actually I have never seen an application doing so). So you can implement some "Search" operation in your dialog, as you said add an edit box and search for its content. You can use the LVM_FINDITEM message (or the ListView_FindItem() macro) requesting a partial-match search (LVFI_PARTIAL), or do the search yourself (find the matching item and move there).

Transfer form elements between tabs on scope change in Qt

My problem is quite simple: I need to transfer form elements from one tab to another.
Say I've ten tabs and each tab has it's own set of text edits.
Is it possible to create just one set of text edits and transfer it from one tab to another,changing functionality behind it, but without changing the forms layout?
Currently I've "solved" that problem just by populating copy of text edit's for each tab but common sense tells me that there's a simpler way to achieve that in Qt.
I'm using Qt 5.7.
Yes, it's possible using a single QTabBar. A QTabBar, as its name suggests, only displays a narrow bar with multiple tabs within.
You can put a frame below that tab bar and listen for tab change signal which is emitted by the QTabBar. In this way, the frame below is the same for all tabs, so you can change underlying logic for each tab.

Lookup Combo that supports remote data - load data only after user wants to

I'm building a VCL c++ builder application. I would like to see if anyone knows of a component that can load data in the lookup upon drop down only after a user has typed a few letters to limit the rows queried? Preferably after pressing Tab, or Enter.
What I would like best is to get a behaviour similar to what Linux command line has, but that might be wishful thinking. The way it would work is to drop down the combo list after user presses tab only if there is multiple options available, and to fill in additional text till the point where characters are not the same anymore, then if user presses tab again, drop down list.
The next best would be if the drop down would only allow drop down if user has typed a few letters, then pressing a specific button opens the dataset with the parameter of the typed text so far, then drops down the combo.
Does a component like this exist?
You can check out TMS Software. I'm not sure if it has something exactly for you, but their components are quite flexible. And you can send a feature request to them - to consider for next update. If you are lucky they might add it to next release.

Is it possible to tell if a user has viewed a portion of the page?

As the title says on a website is it possible to tell if a user has viewed a portion of the page?
Will moving that portion to a separate iframe work? then if they scroll to the bottom, issue a get request for a small image file..forgot the name of the technique..
Update: It is called Web Bug..A Web bug is an object that is embedded in a web page or e-mail and is usually invisible to the user but allows checking that a user has viewed the page or e-mail. One common use is in e-mail tracking. Alternative names are Web beacon, tracking bug, tracking pixel, pixel tag, 1×1 gif, and clear gif.
If you are talking about to check if the user has actually viewed some part of the page you would need to install a web camera and track his eye-movement.
If you are talking about detecting how far the user has scrolled down the page, you can use Javascript to detect this in the OnScroll event. You can then fire some ajax to the server if you need to record this.
I'm not sure this would be ethical - but technically if you use javascript, you could detect the mouseover event of each paragraph tag in the document, and then AJAX that information back to the server. As the user scrolls down the page, they're likely to mouse over the paragraphs, and then you know at least approximately where they've read to.
Not reliably, no.
Simple example: I middle-click on a link, which opens it in a new background tab. I then decide against it, and close the tab without ever looking at it. Any JavaScript trick is going to report that I viewed everything above the fold.
More complicated example: A newbie user doesn't have the browser window maximised, and a portion of the browser window is off-screen. Any JavaScript trick is going to report as if the entire viewport is being viewed, so even restricting your query to only the cases where scrolling occurs will not help.
Unless you require a user action of some kind, all you will be able to tell is that they downloaded some portion, not that they actually looked at it.
Sure. Put that content inside a div, then in your html, with some javascript, capture the onmouseover event and do your work there. If they've put their mouse over something, it's a pretty safe bet that they've seen it, I'd say...
Hope this helps.