Extend dialog dynamically -VC

On clicking a button, i want the dialog to expand and show a hidden part.
-Similar to what happens when you click "Define Custom Color>>" button in CColorDialog
ArchsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ArchsAuthor Commented:
This is urgent....please help!
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Use the resource editor to create the dialog fully, And when displaying first time, in oninitdialog(), display only the required part. using co-ordinates using MoveWindow() function.

And whenever u want to display it fully, again dislay using the same concept.

Say in OnInitDialog(), U want to display some part, here is the sample code

CRect rect;
GetWindowRect(&rect);
ScreenToClient(rect);
          
MoveWindow((::GetSystemMetrics(SM_CXFULLSCREEN)/2 - (rect.Width()/2)),                ((::GetSystemMetrics(SM_CYFULLSCREEN)+ ::GetSystemMetrics(SM_CYMENU))/2 - (rect.Height()/2) + ::GetSystemMetrics(SM_CYMENU)),
                   rect.Width(),
                   rect.Height()-235,
                   TRUE
                   );

Then Whenever u wan tto display fully,

WINDOWPLACEMENT  CanPlace;
this->GetWindowPlacement(&CanPlace);
CRect rect(&CanPlace.rcNormalPosition);            
rect.bottom += 235;
this->MoveWindow(rect,TRUE);

If u want I can give u the code.

Cheers,
VinExpert
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ArchsAuthor Commented:
Yes...VinExpert could u give me the code as this is very urgent!
THANX
0
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

ArchsAuthor Commented:
Hey ! Thanx ... that works beautifully!
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Good then. I need not send the sample to u. Anyway that sample contains the same thing.

Cheers,
VinExpert
0
ArchsAuthor Commented:
Hey Vin .. may i know what u do?
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

U might have noticed by now!!!. I am just writing a comment to U.

Ha, Ha, Ha,
VinExpert

(mail me at k_bbb100@hotmail.com)
0
ArchsAuthor Commented:
very funny!
:?)

well..anyway...good day to u !
will mail u sometime!

- Arch
0
ArchsAuthor Commented:
hey..just another question...
how do i change the background color of a list box to grey?

0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Intelligent saved some 200 points. (hope u never mind my such comments)

Ok. In OnCtlColor()

do this

if(nCtlColor == CTLCOLOR_LISTBOX)
{
return YourColorBrush;
}

Hay, feel free to ask questions.
Cheers,
VinExpert
0
ArchsAuthor Commented:
that doesn't work!
 well...as for saving points...remember i am new to this site .. hence i have no points left.  I have not intention what so ever of cheating.

The list box color doesn't change.
0
ArchsAuthor Commented:
SORRRRY!
THAT WORKS...
BUT WHAT IS THE #defined value for the default grey color .... remember something like SOLIDGREY..OR something.
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Take it cool. No prob.

Wait I will do some R&D and tell it U.
VinExpert
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

I got it!!!.

Just replace the line in OnInitDialog() from
m_MyBrush.CreateSolidBrush(...) to
m_MyBrush.CreateStockObject(LTGRAY_BRUSH);

and in OnCtlColor() return that brush as I told.

This will solve Ur problem.(and sorry for the delay. I had some work)

VinExpert

::r u a Indian?(:-), :-) Guess work)
0
ArchsAuthor Commented:
THX!
YEP !
U TOO EH!
WHERE R U FROM?
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

So U R from India.
Good full marks to me then. I am from Karnataka, working bangalore. What about U?

VinExpert
0
ArchsAuthor Commented:
I know u r from b'lore !!
I am at Nihon (Japan)
0
ArchsAuthor Commented:
hi...another doubt...
very stupid one..but i really can't remember how to do it...

how do i insert a newline in a text in a multiline edit box?
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

U R From which place in India?.

I am from Bagalkot.

VinExpert
0
ArchsAuthor Commented:
cannot give details here....shall write to ur id later.......
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Fine!!! So U got a job to do then.(sorry, again guessing)

VinExpert
0
ArchsAuthor Commented:
very good at guessing too!
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Thats not the stupid one. But the solution is definitly stupid!!!.

This is not working
CString str("Hurree\n\rHappy?");
((CEdit *)GetDlgItem(IDC_EDIT1))->SetWindowText(str);

This is working
CString str("Hurree\r\nHappy?");
((CEdit *)GetDlgItem(IDC_EDIT1))->SetWindowText(str);

How is that?
VinExpert

0
ArchsAuthor Commented:
SUGOI ! EXCELLENT!
I tried all permutations and combinations except this one!!!!
good!

how long have u been working on vc?
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

just a year. And still lot to learn.
(U have msn messanger attached to ur email ID to EE?)

I am waiting for Ur mail with Ur details.
VinExpert
0
ArchsAuthor Commented:
nope...why do u ask?
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Usually what U get from questions?. Some info. For That...simple right?. U were responding so fast. So I got doubt.

VinExpert
0
ArchsAuthor Commented:
Actually ... I got that doubt about u too !!!
0
ArchsAuthor Commented:
Here's another question :
If I set an edit box 's color to blue,
and make it read only - the grey color
overlaps the blue.  How do i change the color of the 'read only' edit box to blue rather than grey?
Secondly, how do i change the text color of the text in the edit box?
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Wow, That is the difficult of all man / mam(.....mam?).

I don't think u can do that. But I can suggest u the work around for an edit box to act as read only, but not by property. Ready, then follow the steps.

1. Go to classwizard and add the control variable to the edit box of CEdit type.

2. Using class wizard add a new class CMyEdit derived from CEdit.

3. Go to dialog's .h file and include the MyDlg.h there and replace the control variable of type CEdit to CMyEdit.

4. Now go to class wizard and map the WM_CHAR message to the CMyEdit class.

5. Go the OnChar(...) function and comment out the only line.

6. Remove the Read Only property of Ur edit box.

Thats it. U can set the color, but user is not allowed to enter the data!!!.

Hope this helps U
VinExpert
0
ArchsAuthor Commented:
hey that's fine...but the background color does not change now ...
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Have U removed the Read Only Property?....

And In OnCtlColor() have done like this
if(nCtlColor == CTLCOLOR_EDIT)
      {
            pDC->SetTextColor(RGB(0,0,255));
            pDC->SetBkColor(RGB(0,255,0));
            return (m_MyBrush1);
      }

Try it out.
VinExpert
0
ArchsAuthor Commented:
hey that's fine...but the background color does not change now ...
0
ArchsAuthor Commented:
Superb! works fine!

Hats off to u!

THANK U!

It's 9.30 here now and guess i gotta leave for the day.  Today is the last working day at Japan in most of the companies....so shall catch u again in the next century !!!! -
on Jan 5th 2000 !

UNTIL THEN .....
HAVE A GREAT TIME...
AND
HAPPY NEW YEAR!

-Arch
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Same to U too.

VinExpert
0
ArchsAuthor Commented:
OHAYO GOZAIMASU (good morning in jap!)
HOPE THE YEAR HAS STARTED OFF WELL FOR U!

- Archs
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Shubha Munjavu(good morning in kannada!!!)

I hope the same for(from) U.

How the work is going?

VinExpert
0
ArchsAuthor Commented:
yeah...going on ok....i am trying to invoke a html on clicking a menu option...do you know how that's done?
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Well, I have rough idea. U have to use CInternetConnection and CHttpConnection and its members. Which version of VC r U using?

VinExpert
0
ArchsAuthor Commented:
vc 6 - oh no ... it can be done with simply using an ocx control like web browser 2...i have done it...thx !
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

Good, I thought U don't want to use ActiveX. Basically because till today I dont have any idea to control it's messages. Say if the URL does not exists, then WebBrowser will give u the error message. But I can't trap it. For app the Navigate(...) function is always a successful one!!!. Like this some probs r there.

VinExpert
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.