ScrollPanel problem
BlitzMax Forums/MaxGUI Module/ScrollPanel problem
| ||
Hi, I've a problem with ScrollPanel gadget. I can't see it's childs appear, but i can change its color. This is a part of my code : zoneChat = CreatePanel( cWidth - 256, Int(cHeight / 4), 256, Int(cHeight / 4), window ) titleChat = CreateLabel( "Messagerie instantanée", 0, 0, ClientWidth(zoneChat), 25, zoneChat, LABEL_LEFT | LABEL_FRAME ) SetGadgetTextColor( titleChat, 0, 0, 0 ) SetPanelColor( titleChat, 200, 200, 200 ) Const MaxChats = 16 + 1 Local gadgetCheckboxChat[MaxChats] Local gadgetColorChat[MaxChats] Local gadgetTextChat[MaxChats] Local ChatR[MaxChats] Local ChatG[MaxChats] Local ChatB[MaxChats] Local ChatCount = 1 ChatR[0] = 0 ChatG[0] = 255 ChatB[0] = 0 scrollChat = CreateScrollPanel( 0, 25, ClientWidth(zoneChat), ClientHeight(zoneChat) - (25 + 25), zoneChat, SCROLLPANEL_SUNKEN ) SetPanelColor( scrollChat, 255, 255, 255 ) gadgetCheckboxChat[0] = CreateButton( "", 0, 0, 25, 25, scrollChat, BUTTON_CHECKBOX ) gadgetColorChat[0] = CreatePanel( 25, 0, 50, 25, scrollChat) SetPanelColor( gadgetColorChat[0], ChatR[0], ChatG[0], ChatB[0] ) gadgetTextChat[0] = CreateLabel( "Commun", 100, 0, ClientWidth(scrollChat) - 100, 25, scrollChat ) FitScrollPanelClient( scrollChat, SCROLLPANEL_SIZETOKIDS ) ScrollScrollPanel( scrollChat, SCROLLPANEL_LEFT, SCROLLPANEL_TOP ) addChat = CreateButton( "Ajout Tchat", 0, ClientHeight(zoneChat) - 25, 128, 25, zoneChat ) deleteChat = CreateButton( "Suppr TChat", 128, ClientHeight(zoneChat) - 25, 128, 25, zoneChat ) |
| ||
Hi, It's hard to tell the exact nature of your problem. Could you create a runable example ? -Henri |
| ||
OkImport MaxGui.Drivers Import MaxGUI.ProxyGadgets dWidth = ClientWidth(Desktop()) dHeight = ClientHeight(Desktop()) ' === Création de la fenetre de départ === window = CreateWindow( "Test Window", 0, 0, dWidth, dHeight, Null, WINDOW_TITLEBAR | WINDOW_MENU ) cWidth = ClientWidth(window) cHeight = ClientHeight(window) ' === Création des gadgets de la fenêtre === zoneEvt = CreatePanel( cWidth - 256, 0, 256, Int(cHeight / 4), window ) titleEvt = CreateLabel( "Évènements", 0, 0, ClientWidth(zoneEvt), 25, zoneEvt, LABEL_LEFT | LABEL_FRAME ) SetGadgetTextColor( titleEvt, 0, 0, 0 ) SetPanelColor( titleEvt, 200, 200, 200 ) gadgetEvt = CreateTextArea( 0, 25, ClientWidth(zoneEvt), ClientHeight(zoneEvt) - 25, zoneEvt, TEXTAREA_WORDWRAP | TEXTAREA_READONLY ) SetGadgetTextColor( gadgetEvt, 0, 0, 0 ) SetGadgetColor( gadgetEvt, 255, 255, 255 ) SetTextAreaText( gadgetEvt, "Coucou" + Chr(13) ) zoneChat = CreatePanel( cWidth - 256, Int(cHeight / 4), 256, Int(cHeight / 4), window ) titleChat = CreateLabel( "Messagerie instantanée", 0, 0, ClientWidth(zoneChat), 25, zoneChat, LABEL_LEFT | LABEL_FRAME ) SetGadgetTextColor( titleChat, 0, 0, 0 ) SetPanelColor( titleChat, 200, 200, 200 ) Const MaxChats = 16 + 1 Local gadgetCheckboxChat[MaxChats] Local gadgetColorChat[MaxChats] Local gadgetTextChat[MaxChats] Local ChatR[MaxChats] Local ChatG[MaxChats] Local ChatB[MaxChats] Local ChatCount = 1 ChatR[0] = 0 ChatG[0] = 255 ChatB[0] = 0 scrollChat = CreateScrollPanel( 0, 25, ClientWidth(zoneChat), ClientHeight(zoneChat) - (25 + 25), zoneChat, SCROLLPANEL_SUNKEN ) SetPanelColor( scrollChat, 255, 255, 255 ) gadgetCheckboxChat[0] = CreateButton( "", 0, 0, 25, 25, scrollChat, BUTTON_CHECKBOX ) gadgetColorChat[0] = CreatePanel( 25, 0, 50, 25, scrollChat) SetPanelColor( gadgetColorChat[0], ChatR[0], ChatG[0], ChatB[0] ) gadgetTextChat[0] = CreateLabel( "Commun", 100, 0, ClientWidth(scrollChat) - 100, 25, scrollChat ) FitScrollPanelClient( scrollChat, SCROLLPANEL_SIZETOKIDS ) ScrollScrollPanel( scrollChat, SCROLLPANEL_LEFT, SCROLLPANEL_TOP ) addChat = CreateButton( "Ajout Tchat", 0, ClientHeight(zoneChat) - 25, 128, 25, zoneChat ) deleteChat = CreateButton( "Suppr TChat", 128, ClientHeight(zoneChat) - 25, 128, 25, zoneChat ) Repeat ev = WaitEvent() Select ev Case EVENT_WINDOWCLOSE es = EventSource() Select es Case window End EndSelect EndSelect Forever End |
| ||
I betting that the heart of the problem is that you are not defining variable type as 'tgadget' . This means that Blitzmax assumes they are 'int's . Try using 'Superstrict' statement at the start of your file and correct every compiler error to see if it corrects the problem. If you press 'F1' on top of e.g. CreateWindow()-function ,you'll see it is returning 'TGadget'. Also array that is holding TGadget objects should be defined as array:Tgadget[arraySize] -Henri |
| ||
Hi Henri, I've done this but i've still the same problem. (note than the scrollpanel is a :TScrollPanel) EDIT: Just tested it on my Mac, it works fine. It should be a problem with Windows 7 x64 Pro. |
| ||
Try this: -Henri |
| ||
Thanks a lot, it works now. |
| ||
No problem:-) Superstrict might seem tedious at first because everything must be declared, but it greatly improves the readibility of code and makes debugging easier. -Henri |