@@ -198,10 +198,9 @@ TextBox_Scroll_TextLayer( ScrollBar_Data data, void *arg )
198
198
LCUI_Pos pos ;
199
199
200
200
pos .x = 0 ;
201
- pos .y = data .max_size - data .current_size ;
202
- pos .y = pos .y * data .current_num * 1.0 / data .max_num ;
201
+ pos .y = data .current_num ;
203
202
pos .y = 0 - pos .y ;
204
- printf ("%d\n" , pos .y );
203
+ printf ("offset.y: %d\n" , pos .y );
205
204
TextBox_TextLayer_Set_Offset ( widget , pos );
206
205
Update_Widget ( widget );
207
206
}
@@ -315,9 +314,11 @@ static void
315
314
Exec_TextBox_Update ( LCUI_Widget * widget )
316
315
/* 更新文本框的文本图层 */
317
316
{
317
+ printf ("Exec_TextBox_Update(): enter\n" );
318
318
Exec_Update_Widget ( TextBox_Get_Label ( widget ) );
319
319
TextBox_ScrollBar_Update ( widget );
320
320
TextBox_Cursor_Update ( widget );
321
+ printf ("Exec_TextBox_Update(): quit\n" );
321
322
}
322
323
323
324
static void
@@ -419,7 +420,9 @@ TextBox_ViewArea_Update( LCUI_Widget *widget )
419
420
area_pos .y = cursor_pos .y ;
420
421
}
421
422
if (cursor_pos .y + cursor_h > area_pos .y + area_size .h ) {
423
+ printf ("outrange\n" );
422
424
area_pos .y = cursor_pos .y + cursor_h - area_size .h ;
425
+ printf ("area_pos.y: %d\n" , area_pos .y );
423
426
}
424
427
/* 如果显示区域在Y轴上超过文本图层的范围 */
425
428
if ( area_pos .y + area_size .h > layer_size .h ) {
@@ -432,9 +435,12 @@ TextBox_ViewArea_Update( LCUI_Widget *widget )
432
435
ScrollBar_Set_CurrentNum ( scrollbar , area_pos .y );
433
436
/* 获取滚动条的数据,供滚动文本层利用 */
434
437
scrollbar_data = ScrollBar_Get_Data ( scrollbar );
438
+
439
+ printf ("scrollbar_data: size: %d / %d, num: %d / %d\n" ,
440
+ scrollbar_data .current_size , scrollbar_data .max_size ,
441
+ scrollbar_data .current_num , scrollbar_data .max_num );
435
442
/* 根据数据,滚动文本图层至响应的位置,也就是移动文本显示区域 */
436
443
TextBox_Scroll_TextLayer ( scrollbar_data , widget );
437
- Update_Widget ( widget );
438
444
printf ("TextBox_ViewArea_Update(): quit\n" );
439
445
return 0 ;
440
446
}
@@ -484,6 +490,7 @@ void TextBox_Text_Add(LCUI_Widget *widget, char *new_text)
484
490
485
491
layer = TextBox_Get_TextLayer ( widget );
486
492
TextLayer_Text_Add ( layer , new_text );
493
+ Update_Widget ( widget );
487
494
TextBox_ViewArea_Update ( widget );
488
495
}
489
496
0 commit comments