(win32) scrollbar sur partie de l'ecran

mogwai93 Messages postés 362 Date d'inscription mardi 31 décembre 2002 Statut Membre Dernière intervention 4 novembre 2023 - 11 oct. 2005 à 19:16
mogwai93 Messages postés 362 Date d'inscription mardi 31 décembre 2002 Statut Membre Dernière intervention 4 novembre 2023 - 20 oct. 2005 à 20:55
bonjour,



j'aimerais avoir un scrollbar que sur une zone de l'ecran

exemple : http://img154.imageshack.us/img154/221/image6gr.gif



pour le moment, j'arrive à "scroller" une fenetre entiere (avec le parametre WS_VSCROLL)

mais pour une partie de l'ecran ???



merci

8 réponses

magic_Nono Messages postés 1878 Date d'inscription jeudi 16 octobre 2003 Statut Membre Dernière intervention 16 mars 2011
13 oct. 2005 à 14:18
Tu peux par ex prendre une fenetre fille

qui a un scrollbar...

___________________________________________________________
Magicalement
Nono
0
mogwai93 Messages postés 362 Date d'inscription mardi 31 décembre 2002 Statut Membre Dernière intervention 4 novembre 2023
13 oct. 2005 à 15:45
tu veux dire qu'il faut "poser" une fenetre qui a un scrollbar sur la fenetre principale ?
si oui, comment faire ?
car j'obtiens 2 fenetres differentes :-(

merci
0
magic_Nono Messages postés 1878 Date d'inscription jeudi 16 octobre 2003 Statut Membre Dernière intervention 16 mars 2011
13 oct. 2005 à 18:18
fille => style CHILD, border NONE



puis Create !

___________________________________________________________
Magicalement
Nono
0
mogwai93 Messages postés 362 Date d'inscription mardi 31 décembre 2002 Statut Membre Dernière intervention 4 novembre 2023
13 oct. 2005 à 19:13
c'etait le WS_CHILD que j'avais oublié !

ca marche sur un cas simple

je vais voir sur un cas + complet



merci
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
mogwai93 Messages postés 362 Date d'inscription mardi 31 décembre 2002 Statut Membre Dernière intervention 4 novembre 2023
14 oct. 2005 à 09:29
j'ai encore un petit souci :
- j'ai bien ma fenetre generale et la fenetre fille avec l'ascenceur dans la zone que je desire


- j'aimerais rajouter sur la fenetre fille, des objets "texte"
j'ai cree ces objets en disant qu'ils etaient fils de la fenetre fille.
appel du genre :
for (int i = 1; i <= NB_MAX; i++)
{
hEdit = createwindow(...)
}
si les coordonnes passees dans le createwindow sont fixes (indenpendantes de i), il m'en cree NB_MAX les uns en dessous des autres !!
et le scroll me donne un resultat etrange :-/


si par contre, j'utilise SetWindowLong sur la fenetre fille, là ils ne s'affichent plus :-/


merci
en esperant avoir ete clair !
0
magic_Nono Messages postés 1878 Date d'inscription jeudi 16 octobre 2003 Statut Membre Dernière intervention 16 mars 2011
14 oct. 2005 à 11:49
pour le cas ou elles ne s'affiche plus,

lance un MS_SHOW ou assimilé



sinon, tres curieux...

___________________________________________________________
Magicalement
Nono
0
mogwai93 Messages postés 362 Date d'inscription mardi 31 décembre 2002 Statut Membre Dernière intervention 4 novembre 2023
14 oct. 2005 à 14:25
je n'arrete pas de tester toutes les possibilités, mais je n'obtiens tjs pas le resultat escompte.
merci de m'aiguiller !

la fenetre fille doit etre créée juste apres la fenetre principale
ou dans le WM_CREATE de la fenetre principale ?

les edits doivent etre créés dans le WM_CREATE de la fenetre principale
ou dans le WM_CREATE de la fenetre fille ?

si ca peut aider, voici les declarations de mes fenetres :
hFenetre_fille = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"", /* Title Text */
WS_BORDER|WS_VISIBLE |WS_CHILD| WS_VSCROLL, /* default window */
1, /* Windows decides the position */
50, /* where the window ends up on the screen */
535, /* The programs width */
250, /* and height in pixels */
hwnd, /* The window is a child-window to desktop */
NULL, /* No menu */
hInst, /* Program Instance handler */
NULL /* No Window Creation data */
);

for (int i = 1; i <= NB_ITEMS; i++)
{
hEdit = CreateWindowEx(0, //more or 'extended' styles
"Edit", //'class' of control to create
TEXT(""), //the control caption
WS_CHILD|WS_VISIBLE|WS_BORDER|ES_CENTER, //control style: how it looks
100, //control position: left
30*i, //control position: top
100, //control width
20, //control height
hFenetre_fille, //parent window handle
(HMENU)(ID_EDIT_FIRST + i), //control's ID
hInst, //application instance

NULL);
}

merci
0
mogwai93 Messages postés 362 Date d'inscription mardi 31 décembre 2002 Statut Membre Dernière intervention 4 novembre 2023
20 oct. 2005 à 20:55
si qqn peut me dire pourquoi les champs edit ne s'affichent pas



merci





#include <windows.h>



/* Declare Windows procedure */

LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

WNDPROC OldEditProc;



/* Make the class name into a global variable */

char szClassName[ ] = "WindowsApp";

HINSTANCE hInst;





LRESULT CALLBACK EditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

{

HWND hBuffer;



switch (message)

{

case WM_CREATE :

hBuffer = CreateWindow(

"Edit",

TEXT(""),



WS_CHILD|WS_VISIBLE|WS_BORDER|ES_CENTER ,

1,

20,

100,

20,

hwnd,

(HMENU)(1),

hInst,

NULL);

break;





default:

break;

}

// Appeler la procédure originale:

return CallWindowProc(OldEditProc, hwnd, message, wParam, lParam);

}









int WINAPI WinMain (HINSTANCE hThisInstance,

HINSTANCE hPrevInstance,

LPSTR lpszArgument,

int nFunsterStil)



{

HWND hwnd; /* This is the handle for our window */

MSG messages; /* Here messages to the application are saved */

WNDCLASSEX wincl; /* Data structure for the windowclass */



hInst = hThisInstance;

/* The Window structure */

wincl.hInstance = hThisInstance;

wincl.lpszClassName = szClassName;

wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */

wincl.style = CS_DBLCLKS; /* Catch double-clicks */

wincl.cbSize = sizeof (WNDCLASSEX);



/* Use default icon and mouse-pointer */

wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);

wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);

wincl.hCursor = LoadCursor (NULL, IDC_ARROW);

wincl.lpszMenuName = NULL; /* No menu */

wincl.cbClsExtra = 0;
/* No extra bytes after the
window class */

wincl.cbWndExtra = 0;
/* structure or the window
instance */

/* Use Windows's default color as the background of the window */

wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;



/* Register the window class, and if it fails quit the program */

if (!RegisterClassEx (&wincl))

return 0;



/* The class is registered, let's create the program*/

hwnd = CreateWindowEx (

0,
/* Extended possibilites for
variation */

szClassName, /* Classname */

"Windows App", /* Title Text */

WS_EX_CONTROLPARENT|WS_OVERLAPPEDWINDOW, /* default window */

CW_USEDEFAULT, /* Windows decides the position */

CW_USEDEFAULT, /* where the window ends up on the screen */

544, /* The programs width */

375, /* and height in pixels */

HWND_DESKTOP, /* The window is a child-window to desktop */

NULL, /* No menu */

hThisInstance, /* Program Instance handler */

NULL /* No Window Creation data */

);



/* Make the window visible on the screen */

ShowWindow (hwnd, nFunsterStil);



/* Run the message loop. It will run until GetMessage() returns 0 */

while (GetMessage (&messages, NULL, 0, 0))

{

/* Translate virtual-key messages into character messages */

TranslateMessage(&messages);

/* Send message to WindowProcedure */

DispatchMessage(&messages);

}



/* The program return-value is 0 - The value that PostQuitMessage() gave */

return messages.wParam;

}





/* This function is called by the Windows function DispatchMessage() */



LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

{

HWND hBuffer, hBuffer2;



switch (message) /* handle the messages */

{

case WM_CREATE:



hBuffer = CreateWindowEx (

0,
/* Extended possibilites for
variation */

szClassName, /* Classname */

"Windows App", /* Title Text */

WS_CHILD |WS_VISIBLE | WS_VSCROLL, /* default window */

50, /* Windows decides the position */

50, /* where the window ends up on the screen */

440, /* The programs width */

200, /* and height in pixels */

hwnd, /* The window is a child-window to desktop */

NULL, /* No menu */

hInst, /* Program Instance handler */

NULL /* No Window Creation data */

);

OldEditProc= (WNDPROC) SetWindowLong(hBuffer, GWL_WNDPROC, (LPARAM)EditProc);

break;



case WM_DESTROY:

PostQuitMessage (0); /* send a WM_QUIT to the message queue */

break;

default:
/* for messages that we don't
deal with */

return DefWindowProc (hwnd, message, wParam, lParam);

}



return 0;

}
0
Rejoignez-nous