Mercurial > dwindows
comparison dwtest.c @ 2724:c1f8e598960d
Only expand the calendar control and box horizontally....
This works around an apparnent bug in either the Android layout or
CalendarView control. It was reporting 0 size and apparently making the
control 0 size, thus invisible when expanding both directions.
This is probably the idea way to layout the calendar control anyway so maybe
it won't be a big deal, but it deserves further investigation in the future.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 09 Dec 2021 19:51:48 +0000 |
parents | 43d630b2b37f |
children | 06b368d2e4f9 |
comparison
equal
deleted
inserted
replaced
2723:27fd270cb0db | 2724:c1f8e598960d |
---|---|
296 | 296 |
297 char *read_file(char *filename) | 297 char *read_file(char *filename) |
298 { | 298 { |
299 char *errors = NULL; | 299 char *errors = NULL; |
300 | 300 |
301 fp = fopen(filename, "r" ); | 301 fp = fopen(filename, "r"); |
302 if(!fp) | 302 if(!fp) |
303 errors = strerror(errno); | 303 errors = strerror(errno); |
304 else | 304 else |
305 { | 305 { |
306 int i,len; | 306 int i,len; |
309 /* should test for out of memory */ | 309 /* should test for out of memory */ |
310 max_linewidth=0; | 310 max_linewidth=0; |
311 for(i=0; i<1000; i++) | 311 for(i=0; i<1000; i++) |
312 { | 312 { |
313 lp[i] = (char *)calloc(1, 1025); | 313 lp[i] = (char *)calloc(1, 1025); |
314 if (fgets( lp[i], 1024, fp) == NULL) | 314 if (fgets(lp[i], 1024, fp) == NULL) |
315 break; | 315 break; |
316 len = (int)strlen( lp[i]); | 316 len = (int)strlen(lp[i]); |
317 if (len > max_linewidth) | 317 if (len > max_linewidth) |
318 max_linewidth = len; | 318 max_linewidth = len; |
319 if(lp[i][len - 1] == '\n') | 319 if(lp[i][len - 1] == '\n') |
320 lp[i][len - 1] = '\0'; | 320 lp[i][len - 1] = '\0'; |
321 } | 321 } |
614 return TRUE; | 614 return TRUE; |
615 } | 615 } |
616 | 616 |
617 int DWSIGNAL browse_file_callback(HWND window, void *data) | 617 int DWSIGNAL browse_file_callback(HWND window, void *data) |
618 { | 618 { |
619 char *tmp; | 619 char *tmp = dw_file_browse("Pick a file", "dwtest.c", "c", DW_FILE_OPEN); |
620 tmp = dw_file_browse("Pick a file", "dwtest.c", "c", DW_FILE_OPEN); | |
621 if(tmp) | 620 if(tmp) |
622 { | 621 { |
623 char *errors = read_file(tmp); | 622 char *errors = read_file(tmp); |
624 char *title = "New file load"; | 623 char *title = "New file load"; |
625 char *image = "image/test.png"; | 624 char *image = "image/test.png"; |
1614 buttonsbox = dw_box_new(DW_VERT, 2); | 1613 buttonsbox = dw_box_new(DW_VERT, 2); |
1615 dw_box_pack_start(notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); | 1614 dw_box_pack_start(notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); |
1616 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); | 1615 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); |
1617 | 1616 |
1618 calbox = dw_box_new(DW_HORZ, 0); | 1617 calbox = dw_box_new(DW_HORZ, 0); |
1619 dw_box_pack_start(notebookbox5, calbox, 0, 0, TRUE, TRUE, 1); | 1618 dw_box_pack_start(notebookbox5, calbox, 0, 0, TRUE, FALSE, 1); |
1620 cal = dw_calendar_new(100); | 1619 cal = dw_calendar_new(100); |
1621 dw_box_pack_start(calbox, cal, -1, -1, TRUE, TRUE, 0); | 1620 dw_box_pack_start(calbox, cal, -1, -1, TRUE, FALSE, 0); |
1622 | 1621 |
1623 dw_calendar_set_date(cal, 2019, 4, 30); | 1622 dw_calendar_set_date(cal, 2019, 4, 30); |
1624 | 1623 |
1625 /* | 1624 /* |
1626 * Create our file toolbar boxes... | 1625 * Create our file toolbar boxes... |