dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14

Thread: Dialog based Application Question.

  1. #1
    Join Date
    Nov 2006
    Posts
    6

    Dialog based Application Question.

    I have a specific problem relating to GUI. i have designed a skin based dialog application that has owner drawn controls. it works fine on normal desktop settings on all resolutions. But if someone changes system settings by right clicking then Desktop properties >> appearance tab >> advance button and changes some properties of objects. Now if i run my dialog application the main dialog windows sets itself according to the resolution selected (i mean if higher resolution then dialog becomes small including button) but the buttons do not change their position relative to new dialog size they still remain according to the old position that was on big dialog. so dialog looks so odd some button even does not appear on dialog but outside. Can someone help what is missing. i have to handle some message or how can i set these button to change their position with respect to resolution. i am using VC++ 6.0.


    any quick response will be appreciated.
    thanks in advance.

  2. #2
    Join Date
    Aug 2004
    Location
    Romania
    Posts
    84

    Re: Dialog based Application Question.

    Do you position the controls using dpi-independent calculation ? Or they have pixel coordinates ?

  3. #3
    Join Date
    Jul 2005
    Posts
    767

    Re: Dialog based Application Question.

    No I do not see any such problem. Some thing else should be responsible.
    One's mistake cannot be your excuse!

  4. #4
    Join Date
    Apr 2002
    Location
    Michigan, USA
    Posts
    864

    Re: Dialog based Application Question.

    I used to have a similar problem when I would design a dialog with my system and then run the program on another computer with large fonts set.
    The positions of the buttons would be messed up. I think you need to be consistent with the font size.
    Verere testudinem! (Fear the turtle)

    Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein

    Robots are trying to steal my luggage.

  5. #5
    Join Date
    Nov 2006
    Posts
    6

    Re: Dialog based Application Question.

    i do not position buttons i only have a class that draws images on drawitem callback. the problem is in code i am missing something to position the controls because other skin based application has no problem.

  6. #6
    Join Date
    Nov 2006
    Posts
    6

    Re: Dialog based Application Question.

    hi tom,
    can you tell me how can i fix this font problem in application. some idea.

  7. #7
    Join Date
    Apr 2002
    Location
    Michigan, USA
    Posts
    864

    Re: Dialog based Application Question.

    Actually, I don't have any advice. I just told my users (around 20 people) to reset their fonts to small fonts. I never treated it programatically.
    Verere testudinem! (Fear the turtle)

    Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein

    Robots are trying to steal my luggage.

  8. #8
    Join Date
    Apr 2002
    Location
    Michigan, USA
    Posts
    864

    Re: Dialog based Application Question.

    see this thread for a possible solution i.e. don't use sans serif font

    http://www.codeguru.com/forum/showth...ht=small+fonts
    Verere testudinem! (Fear the turtle)

    Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein

    Robots are trying to steal my luggage.

  9. #9
    Join Date
    Nov 2006
    Posts
    6

    Re: Dialog based Application Question.

    thanks a lot for so early response. i check provided link. thanks

  10. #10
    Join Date
    Nov 2006
    Posts
    6

    Re: Dialog based Application Question.

    Hi Tom,

    i have identified the problem if you can give me some more help to solve this one.

    here is the detail.

    i have an image that i use for setting the background of the dialog. first i calculate the region from image on some transparent color usually border color. then i set the dialog region by calling SetWindowRgn method. now if some one dont change system settings from 90 dpi then every thing works fine on every type of reolution (i dont know why because image has fix reolution). but when someone changes system settings from 90 dpi to some other dpi level then button do not remain intact with background image. my idea is image has static reolution and becomes smaller when the resolution is increased so button remain on the place that windows sets after adjusting dpi level. but other application work properly that also use skin as their background etc. as you advised for font settings i did that too but still same problem. is that due to DDB or something else.

    omar lodhi

  11. #11
    Join Date
    Sep 2002
    Location
    14 39'19.65"N / 121 1'44.34"E
    Posts
    9,815

    Re: Dialog based Application Question.

    Your problem is that you are using a dialog box for a custom UI. Dialog boxes are standard Windows UI elements - they bring their own look-and feel, and some behaviour, like resizing and repositioning controls automatically, according to the system base font size chosen by the user - and this behaviour is by design.

    If you want to creat your own UI, you would typically use a generic window instead of a dialog box, and handle all the drawing and positioning of UI elements yourself.

  12. #12
    Join Date
    Nov 2006
    Posts
    6

    Re: Dialog based Application Question.

    thanks a lot, got it. will try to solve the problem that way.

  13. #13
    Join Date
    Jul 2004
    Posts
    40

    Re: Dialog based Application Question.

    Hello gurus,

    how do i get the handle of Dialog itself. I put a button to the dialog, and make script to get the handle.
    How would i do that? I did use vc++ quite sometime now and forgot some functions and declarations, please help!

    Raul

  14. #14
    Join Date
    Sep 2002
    Location
    14 39'19.65"N / 121 1'44.34"E
    Posts
    9,815

    Re: Dialog based Application Question.

    Quote Originally Posted by raul73
    how do i get the handle of Dialog itself. I put a button to the dialog, and make script to get the handle.
    Script? Well, in MFC, you can get any window's handle through GetSafeHwnd().

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)