Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Two Q's: dialog color; compare a number in an edit box
#1
1. How can you change the background color of a dialog.
2. How can you make the macro do somthing if a number in a dialog edit box is greater then 100?

Thanks
Ghost
#2
Function Dialog70
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

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

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 12 8 48 14 ""
;4 Button 0x54032000 0x0 68 8 48 14 "Button"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,GdiObject- brush=CreateSolidBrush(ColorFromRGB(0 0 255))
,case WM_CTLCOLORDLG ret brush
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,str s.getwintext(id(3 hDlg))
,int i=val(s)
,if(i>100)
,,mes ">100"
,else
,,mes "<=100"
,case IDOK
,case IDCANCEL
ret 1
#3
also can u change the color of the buttons on the dialog to?
#4
Button color cannot be changed.
#5
with the background being blue now..the static text background in my dialog is grey and looks funny...is there a way to fix that?
#6
Below
Code:
Copy      Help
,case WM_CTLCOLORDLG ret brush
add
Code:
Copy      Help
,case WM_CTLCOLORSTATIC SetBkMode wParam TRANSPARENT; ret brush
#7
Is there a way to set the text of dialog in an edit so that even when the dialog is not open it can still get the text from the dialog that was saved into the edit box
#8
there are a couple different ways.

The first basic is to just store text in a .txt file.

A little more advanced would be to use rset/rget to write and read an .ini file

A more advanced, but much better way would be to use XML.

There are quite a few posts on the forum about all of this.
#9
This maybe a dumb question but I am new to XML -

Why would XML be a better way?
#10
TheVig Wrote:there are a couple different ways.

The first basic is to just store text in a .txt file.

A little more advanced would be to use rset/rget to write and read an .ini file

A more advanced, but much better way would be to use XML.

There are quite a few posts on the forum about all of this.
do you think you could provide an example with ini? or somthing like that??
#11
Recently there were several posts about saving/restoring text of dialog controls. You save text when closing the dialog, and restore when opening. For example DIALOG AND SPEEDS

You can get the saved text in any macro. You don't need a dialog for this.
Macro
Code:
Copy      Help
str e3
rget e3 "e3" "\Ghost\test"
out e3
#12
Macro
Code:
Copy      Help
str e8
rget e8  "e8" "\Ghost\test"
out e8
str s
s.getwintext(id(15"Notepad"))
if s = e8
,out "-"
else
,out "Does not ="

This works great for dialog. Now the only thing is i want to search an entire list of words to see if s is = to e8... Example:
macro searches for text in box (str s)
Example 1 Fails when running code above-
notepad text box:

this is all the text that is found applicationsrunningonforum in the notepad....ect for text

now str s is = to applicationsrunningonforum *The text in my dialog for e8*

Example 2 works when running code above:

notepad text-

applicationsrunningonforum

what i want to do is make it search the entire text box for "applicationsrunningonforum" (text = to e8) and if found out s else continue
#13
To find text use string functions. For example, find, or findw, or findrx. Look in QM help.

Or
Macro
Code:
Copy      Help
str s="one[]two"
str e8="two"

ARRAY(str) a; int i
a=s
for(i 0 a.len) if(a[i]=e8) break
if(i<a.len)
,out "found"
else
,out "not found"
,
#14
XML can really organize data where it can be called back in very specific ways. I'm fairly new to it myself, really the last couple of weeks, but already I've been able to revolutionize the way that I store and get data in forms that I've created. It is really a powerful tool!

I started off actually using Excel to store and get information. It worked pretty nice because I could store to and call back specific cells. The big problem with that was that it was very slow...very very slow because excel had to open and close and just didn't run fast enough. Then I moved over to .ini files which lasted about a week. I thought they were really cool because you could have a key, a variable, and data. I would also use the file name in a directory to further organize. Using the file names worked pretty good to populate ComboBoxes with a directory.

With XML you can do all of that and much more in one file that runs super fast. Since the markups in XML are all user defined, you can just keep digging in deeper and deeper. When you callback data, you can define a specific XML path...and whammo, data is available!

This first example shows a program that I created using .ini and then one that Gintaras worked up with XML.
The XML is just a lot more streamlined and open to do more. Gintaras also has a way to populate a ComboBox with data in an XML file in this one:
http://www.quickmacros.com/forum/showthr...p?tid=2624

This next example shows XML with data separated with delimiters...another way you can store things.
http://www.quickmacros.com/forum/showthr...p?tid=2614

This example uses XML to store the coordinates of a edit box in without even having to hit an update box. It just automatically saves the data.
http://www.quickmacros.com/forum/showthr...p?tid=2643


Trust me and use XML
#15
That is seven feet of water and I am only six feet tall; Blub Blub Blub. I can not swim yet but give me time.
#16
It's not really that hard...all you have to do is drain the pool by half a foots worth of water and grow 6 inches. You'll be fine!

Start with the simple stuff and break down what you want to do...then just do it. The beauty of quickmacros is that you never really have to learn how to swim.
#17
Gintaras Wrote:To find text use string functions. For example, find, or findw, or findrx. Look in QM help.

Or
Macro
Code:
Copy      Help
str s="one[]two"
str e8="two"

ARRAY(str) a; int i
a=s
for(i 0 a.len) if(a[i]=e8) break
if(i<a.len)
,out "found"
else
,out "not found"
,

How would i make this code search id(15"Notepad") for the word "macro" in a sentance or pargraph?
#18
if(findw(s e8)>=0) ;;or use find
,out "found"
else
,out "not found"
#19
Gintaras Wrote:if(findw(s e8)>=0) ;;or use find
,out "found"
else
,out "not found"
sorry im still confused. do i make s= id(15"Notepad")??? This code got me all confused
#20
Never mind! Found the code out.. now i feel stupid Sad thanks for all the help G~


Forum Jump:


Users browsing this thread: 10 Guest(s)