Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog with IStringMap
Hi, I made this dialog to give me one answer based on a stringmap. I'm having a little problem that I'm getting crazy about it but I'm sure it's so simple to fix, can anyone please help me?

This is my code:

Function bcf_checker
Copy      Help
function# hDlg message wParam lParam
if(hDlg) goto messages

str ss.getfile("S:\****")
IStringMap- m=CreateStringMap(1|2)
m.AddList(ss " ")

str controls = "3"
str e3
if(!ShowDialog("bcf_checker" &bcf_checker &controls)) ret

;0 "" 0x90C80AC8 0x0 0 0 169 102 "BCF Checker"
;3 Edit 0x54030080 0x200 10 16 50 14 ""
;4 Static 0x54000000 0x0 20 2 15 10 "Site"
;5 Static 0x54000000 0x0 110 4 15 10 "BSC"
;7 Static 0x54000000 0x0 110 42 15 10 "BCF"
;8 Edit 0x54200844 0x20000 94 54 60 21 ""
;6 Edit 0x54200844 0x20000 94 16 60 21 ""
;9 Static 0x54000000 0x0 6 42 70 12 "Informação errada?"
;10 Button 0x54032000 0x0 14 56 48 14 "Edit"
;11 Static 0x54000000 0x0 16 70 48 12 "Brevemente"
;12 Static 0x54000000 0x0 128 8 48 12 "Brevemente"
;1 Button 0x54030001 0x4 24 84 130 14 "Done"
;DIALOG EDITOR: "" 0x2030408 "" "" "" ""

sel message
,case WM_COMMAND goto messages2

sel wParam
,case 10 :mac "bcf_edit"
,case EN_CHANGE<<16|3
,str s1.getwintext(lParam) s2
,if(s1.len) m.Get2(s1 s2)
,s2.setwintext(id(8 hDlg))
,case IDOK
ret 1

What I get is, on the "edit" field that I want to edit, everytime I delete it's content to type in a new one the aplication crashes saying: " 0x80070057, The parameter is incorrect. ? "

Can someone help?

Thank you so much! Sad
tip-- to show qm code in forum and get help faster
Q. How to post QM code to the forum?
A. In QM, to copy all or selected text, use menu Edit -> Other Formats -> Copy for QM Forum. It copies correct and colored code to the clipboard. Then simply paste in the forum. Don't use the Code button.
Please make it easier for all of us including yourself and post your qm code this way so we don't have to try and piece your code back together to help you.
Ok Kevin! Thanks for the tip...

Just edited the last post
This code works. No error when deleting text. Maybe if(s1.len) was missing? Where exactly is the error? Not in Get2?
Function bcf_checker
Copy      Help
sel wParam
,case EN_CHANGE<<16|3
,str s1 s2
,,m.Get2(s1 s2)
,,if s2
,,,out s2
,,,s2.setwintext(id(8 hDlg))
,,else out "not found"
i was going by what he said worked for me as well
pedrotairum Wrote:What I get is, on the "edit" field that I want to edit, everytime I delete it's content to type in a new one the aplication crashes saying: " 0x80070057, The parameter is incorrect. ? "
I'm running this macro from a traymenu I created. So I select the option on the tray menu, it launches de function and then that's it.
I input the key to get the value and that's fine, but then when I want to input another key I start deleting the old one on the edit box and when I delete the last character the traymenu crashes and I get that error Sad
Where exactly is the error?
The error is on the Get2 :evil:

edit: Tried deleting the if(s1.len) and error still continues :evil:

OK! Got it!!!!
Just re-wrote the code in other way and it went good for no reason! But it's the same thing ...

Let me just ask one other question:

Since I'm importing the string map from a .txt can I use the function map.Set() to edit the values of the keys in the .txt?
If I can't, is there a way to do it?

Thanks again! Smile
What is s1 then?
Function bcf_checker
Copy      Help
,case EN_CHANGE<<16|3
,str s1.getwintext(lParam) s2
,out F"{s1.len} '{s1}'"

I edited the previous reply, check it out! Thanks
m.GetList(_s " "); _s.setfile("...")
Forgot to get text when saving.

Copy      Help
IStringMap- mm=CreateStringMap(1|4) ;;flag 4 - Add() adds or replaces
Copy      Help
,str f1 f2 f3
,case EN_CHANGE<<16|6
,f1.getwintext(id(6 hDlg))
,if(f1.len) mm.Get2(f1 f2)
,f2.setwintext(id(3 hDlg))
,case 11
,mes "Dados guardados com sucesso!" "Obrigado pelo contributo" "i"
,f1.getwintext(id(6 hDlg)); if(!f1.len) ret
,f3.getwintext(id(8 hDlg))
,mm.Add(f1 f3) ;;adds or replaces, if flag 4 used with CreateStringMap
,mm.GetList(_s " ")

Forum Jump:

Users browsing this thread: 1 Guest(s)