1. Is there an global way to display a dialog in a read-only mode (e.g. all Edit controls disabled) or do I have to create a 2nd version (or page) of the dialog using read-only Edit controls? This is in reference to an INI user settings dialog that loads the existing key values and rewrites the data back to the INI.
Alternatively - and perhaps better - is there a method where all Edit controls are initially read-only, and then provide some per-control method (checkbox, button, ctl-click, whatever) to enable editing a control?
2. Also having trouble getting wrap to display long strings in Edit box (mailto email lists) - it still displays on one line, only with [] added. When written back to the INI the formatting is screwed up so that it won't read the lists properly next time.
Thanks,
S
If you want to take a look, I've attached the files.
i have made the edit boxes multiline, u may need to make edit boxes thicker to display multi line i havent played much with them b4.
started the edit boxes disabled
there is button there to enable them and vice verser.
not sure about ini files,
and also for ur outputs ive made it proberly a bit reader friendly
this may help also with the limits for edit controls
* Single-line edit controls are limited to a maximum of 32K (32,767 bytes) of text and, of course, to a single line. By default, single-line edit controls are limited to 30,000 characters. An application can change this limit to a maximum of 32,767 characters with the EM_LIMITTEXT message described in "Edit Control Messages," later in this article.
* Multiple-line edit controls are limited to a maximum of 64K (65,535 bytes) of text. Whether a multiple-line edit control is actually able to approach this limit is based on how the edit control uses memory. Techniques to control the way edit controls use memory are described in the next section, "Edit Controls and Memory." Multiple-line edit controls are also limited to the following:
o characters per line of text
o lines of text
o pixels per line of text
Thanks for your good work, which does indeed work and better still, helps me along conceptually.
On mem limits, sorry but I'm not quite clear on the application here.
BTW I did get the Wrap function to work in the Edit boxes by removing the flag 1 (which reassembles the delimited string for processing. Makes perfect sense. It was there so that the main macro can send the email list via mailto).
You can see the result by uncommenting the two Wrap lines (lines 34/35 and removing the 1 at the end of each.
the limits is about how much u can use in a single edit box. how many characters and so on, as u said the full string wasnt fully copied to the edit control, and i dont know how inis work, just thought that the string was to large for edit, but u said u got it all sorted out now so dont worry about that.
Thanks
My fault, I didn't explain it well. One problem was that I wanted a string that was too long to fit in the Edit box display to word-wrap to new lines. This I got working as described above.
The second problem - that I still have - is that I need to restore the str output back to the single-line format b/c is incorrectly written back to the INI file as a multi-line, breaking the INI format.
out str pub_mailto out"ORIGINAL INI VALUE" rget(pub_mailto "pub_mailto""email""c:\wrap.ini") out pub_mailto out"" out"WORD WRAP FOR MULTI-LINE EDIT BOX FORMATTING"
pub_mailto.wrap(40""",") out pub_mailto
ORIGINAL INI VALUE
name@www.site.org, name2@www.site.org, name3@site.org, name4@site.org
WORD WRAP FOR MULTI-LINE EDIT BOX FORMATTING
name@www.site.org, name2@www.site.org,
name3@site.org, name4@site.org
The problem: I need to restore/condense/reformat the string output back to the Original formatting (i,e., a single line of email addresses, each separated by a comma and space - like what is in the INI file above. Replacerx for "[]" didn't work. Also tried repx with CR and LF codes with no luck.
Any help is appreciated!
S
EDIT: I should mention that the actual macro (as opposed to this sample) is for adding/removing names from the list, so simply pointing back to the original string won't work.
Very quickly looked at your post and saw problem with escape characters [] ''' etc in str
Not sure if exactly relevant but did you try playing around with the "escape" function - it's described in the qm helpfile but I pasted the entry below.
Stuart
[/quote]Replace escape sequences to characters or vice versa
Syntax
s.escape([flags])
Parts
s - str variable.
flags - one of values below. Default: 0.
0 replace escape sequences ( '', [], [digits]) to characters (", new line, character).
1 replace unsafe characters (", new line, [ , '') to escape sequences.
8 urldecode.
9 urlencode. That is, replace all characters except 0-9, A-Z, a-z, _, - and . to escape sequences in form %xx, where xx is character code in hexadecimal format.
10 same as 8, but decode + to space.
11 same as 9, but encode space to +.
Remarks
Replaces escape sequences to characters, or vice versa.
QM 2.3.0. Removed flag 2 (don't escape characters above 127). Now does not escape these characters. It is because of possible problems with UTF-8.
See also: str.encrypt, str.ansi
Quote:Replace escape sequences to characters or vice versa
Syntax
s.escape([flags])
Parts
s - str variable.
flags - one of values below. Default: 0.
0 replace escape sequences ( '', [], [digits]) to characters (", new line, character).
1 replace unsafe characters (", new line, [ , '') to escape sequences.
8 urldecode.
9 urlencode. That is, replace all characters except 0-9, A-Z, a-z, _, - and . to escape sequences in form %xx, where xx is character code in hexadecimal format.
10 same as 8, but decode + to space.
11 same as 9, but encode space to +.
Remarks
Replaces escape sequences to characters, or vice versa.
QM 2.3.0. Removed flag 2 (don't escape characters above 127). Now does not escape these characters. It is because of possible problems with UTF-8.
Super-stoked that I could help direct you to a solution.
When I was working on something requiring an ini file, Gintaras showed me how to do it with xml. I am not entirely sure I understand why xml is advantageous but it seems like the more modern robust way of doing things and the newere versions of QM support it. I am starting to get the hang of it for multiple different mini-applications I have been writing in QM-script.
Here is the link...Gintaras' solution is kind of way down into it though:
Thanks for the link to XML use - I am in the same boat you are/were...I fully understand INI, which I am using primarily to make my macro (aka albatross) self contained with settings easily editable as opposed to registry use. It looks like XML is the future based on how many programs now use them to store presets etc, and XML offers at least the same benefits as INI, with the exception that it is nowhere near as readable in a text editor.
So...I loaded up Gin's XML example and it sure looks cool, but what exactly does it do?
It's a dialog that allows you to assign often used stock or custom phrases to tab after tab of buttons in the multipage dialog, that are then available for pasting into documents. The small button on each page of the dialog allow you to rename the buttons (i.e. to help you remember what phrase it brings up (displayed in the large text box).
This was kind of a simplified version for the purposes of the forum. I have customized it a lot since then but the xml part works awesomely (THanks Gintaras!!!) for storing the phrases as well as the button titles.
By the way, In this version, it puts your choices on the clipboard.
classCToolTip m_htt ;;delete this if already declared in init2
str controls ="4" str e4
str-- tag ;;was MacroID
;load xml file str-- xmlfile="$desktop$\SampleMacros.xml" if(!dir(xmlfile)) _s="<SampleMacros></SampleMacros>"; _s.setfile(xmlfile);;first time, create new file with no data IXml-- xml
xml=CreateXml
xml.FromFile(xmlfile) IXmlNode-- xr=xml.RootElement ;;this will be often used IXmlNode ne
e4.setclip actwin("Microsoft Word""OpusApp") 'Ai;;menu for inserting comments into Word Doc 'm;;brings up a new comment dialog in Word 0.5 outp e4 ret ;messages CToolTip-- tt ;;CToolTip variables usually can be declared with thread scope (- or --). If thread can have multiple instances of the same dialog, use window scope (SetProp/GetProp). Don't use global and local. sel message ,caseWM_INITDIALOG ,;tab control ,int i t htb=id(3 hDlg) ,TCITEM ti.mask=TCIF_TEXT ,str st="A[]B[]C[]D[]E[]F[]G[]H[]I[]J[]K[]L" ,foreach(ti.pszText st)SendMessage htb TCM_INSERTITEMA i &ti; i+1 , ,;tooltips ,tt.Create(hDlg) ,tt.AddTool(hDlg 4"Text changes apply only for this comment insertion. To permanently change text, Choose Update Macro Text") ,for(i 121141) tt.AddTool(hDlg i "Click to Change Button Text") , ,t=0;goto g11 ;;select first tab ,caseWM_DESTROY ,,tt.Destroy ,caseWM_SETCURSOR ,,tt.OnWmSetcursor(wParam lParam) ,caseWM_COMMANDgoto messages2 ,caseWM_NOTIFYgoto messages3 ret ;messages2 sel wParam ,case6 ,,if(!tag.len)ret ,,str NewMacroText ,,NewMacroText.getwintext(id(4 hDlg)) ,,if(mes("Are you sure you want to permanently change macro text[](i.e. changes will also apply to future sessions)?""Macro Text Change Confirmation""OC?")!='O')ret ,,xr.SetChild(tag NewMacroText) ,,xml.ToFile(xmlfile) ,caseelse ,if(wParam>=101and wParam<=140) ,,t=SendMessage(id(3 hDlg)TCM_GETCURSEL00);;tab ,, ,,if(wParam>=101and wParam<=120);;big button ,,,i=wParam-100 ,,,tag.from("e" t*100+i) ,,,_s=xr.Child(tag).Value;err ,,,_s.setwintext(id(4 hDlg)) ,,else;;small [...] button ,,,wParam-20 ,,,i=wParam-100 ,,,tag.from("e" t*100+i) ,,,str OldButtonText NewButtonText ChangeText ,,,OldButtonText.getwintext(id(wParam hDlg)) ,,,ChangeText.format("Change button text from ''%s'' to:" OldButtonText) ,,,if(!inp(NewButtonText ChangeText "Change Button Text""Enter new button title here....."))ret ,,,ne=xr.Child(tag);if(!ne) ne=xr.Add(tag) ,,,ne.SetAttribute("b" NewButtonText) ,,,xml.ToFile(xmlfile) ,,,NewButtonText.setwintext(id(wParam hDlg)) ,caseIDOK ,caseIDCANCEL ret1 ;messages3 NMHDR* nh=+lParam sel nh.code ,caseTCN_SELCHANGE ,t=SendMessage(nh.hwndFrom TCM_GETCURSEL00) ,;g11 ,;set text of buttons in this tab ,for i 121 ,,NewButtonText=xr.Child(_s.from("e" t*100+i)).AttributeValue("b");err NewButtonText="" ,,NewButtonText.setwintext(id(i+100 hDlg)) ,;click first button to update tag and the textbox ,but101 hDlg